...
1
16
17 package tables
18
19 import (
20 "os"
21 "reflect"
22 "testing"
23 )
24
25 func TestParseJSONDefinitions(t *testing.T) {
26 testdata := os.Getenv("TEST_SRCDIR") + "/" + os.Getenv("TEST_WORKSPACE") + "/tables/testdata"
27 definitions, err := ParseJSONDefinitions(testdata + "/simple_tables.json")
28 if err != nil {
29 t.Error(err)
30 }
31
32 expected := Definitions{
33 IsLabelArg: map[string]bool{"srcs": true},
34 LabelDenylist: map[string]bool{},
35 IsSortableListArg: map[string]bool{"srcs": true, "visibility": true},
36 SortableDenylist: map[string]bool{"genrule.srcs": true},
37 SortableAllowlist: map[string]bool{},
38 NamePriority: map[string]int{"name": -1},
39 StripLabelLeadingSlashes: true,
40 }
41 if !reflect.DeepEqual(expected, definitions) {
42 t.Errorf("ParseJSONDefinitions(simple_tables.json) = %v; want %v", definitions, expected)
43 }
44 }
45
View as plain text