blob: 4c76c7157fb7b56e13fb62d50f7bc558394e71f8 [file] [log] [blame]
package main
import (
"reflect"
"testing"
)
func TestRuleParser(t *testing.T) {
for _, tc := range []struct {
in string
want Rule
} {
{
in: "foo: bar",
want: Rule{
outputs: []string{"foo"},
inputs: []string{"bar"},
},
},
{
in: "foo: bar baz",
want: Rule{
outputs: []string{"foo"},
inputs: []string{"bar", "baz"},
},
},
} {
got := &Rule{}
got.parse(tc.in)
if !reflect.DeepEqual(tc.want, *got) {
t.Errorf(`r.parse(%q)=%q, want %q`, tc.in, tc.want, *got)
}
}
}