blob: 4c76c7157fb7b56e13fb62d50f7bc558394e71f8 [file] [log] [blame]
Shinichiro Hamaji0439a3e2015-04-01 02:01:05 +09001package main
2
3import (
4 "reflect"
5 "testing"
6)
7
8func TestRuleParser(t *testing.T) {
9 for _, tc := range []struct {
10 in string
11 want Rule
12 } {
13 {
14 in: "foo: bar",
15 want: Rule{
16 outputs: []string{"foo"},
17 inputs: []string{"bar"},
18 },
19 },
20 {
21 in: "foo: bar baz",
22 want: Rule{
23 outputs: []string{"foo"},
24 inputs: []string{"bar", "baz"},
25 },
26 },
27 } {
28 got := &Rule{}
29 got.parse(tc.in)
30 if !reflect.DeepEqual(tc.want, *got) {
31 t.Errorf(`r.parse(%q)=%q, want %q`, tc.in, tc.want, *got)
32 }
33 }
34}