github.com/bdwilliams/libcompose@v0.3.1-0.20160826154243-d81a9bdacff0/project/options/types_test.go (about)

     1  package options
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestImageType(t *testing.T) {
     8  	cases := []struct {
     9  		imageType string
    10  		valid     bool
    11  	}{
    12  		{
    13  			imageType: "",
    14  			valid:     true,
    15  		},
    16  		{
    17  			imageType: " ",
    18  			valid:     false,
    19  		},
    20  		{
    21  			imageType: "hello",
    22  			valid:     false,
    23  		},
    24  		{
    25  			imageType: "local",
    26  			valid:     true,
    27  		},
    28  		{
    29  			imageType: "all",
    30  			valid:     true,
    31  		},
    32  	}
    33  	for _, c := range cases {
    34  		i := ImageType(c.imageType)
    35  		if i.Valid() != c.valid {
    36  			t.Errorf("expected %v, got %v, for %v", c.valid, i.Valid(), c)
    37  		}
    38  	}
    39  }