(t *testing.T)
| 78 | } |
| 79 | |
| 80 | func TestCases(t *testing.T) { |
| 81 | entries, err := testCases.ReadDir("test_cases") |
| 82 | if err != nil { |
| 83 | t.Fatal(err) |
| 84 | } |
| 85 | for _, testCase := range entries { |
| 86 | t.Run(testCase.Name(), func(t *testing.T) { |
| 87 | file, err := testCases.ReadFile( |
| 88 | filepath.Join("test_cases", testCase.Name())) |
| 89 | if err != nil { |
| 90 | t.Fatal(err) |
| 91 | } |
| 92 | unit, err := parse.Unit(bytes.NewReader(file)) |
| 93 | if err != nil { |
| 94 | t.Fatal(err) |
| 95 | } |
| 96 | _, err = AnalyzeAndCheckBounds([]parse.SourceUnit{unit}, nil, ErrorForBoundsMismatch) |
| 97 | if strings.HasPrefix(testCase.Name(), "neg") { |
| 98 | if err == nil { // NO error |
| 99 | t.Errorf("No error in test case %s, but we want an error", testCase.Name()) |
| 100 | } |
| 101 | return |
| 102 | } |
| 103 | if err != nil { |
| 104 | t.Errorf("Unexpected error in test case %s: %s", testCase.Name(), err) |
| 105 | } |
| 106 | }) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | func TestCheckRulePositive(t *testing.T) { |
| 111 | tests := []ast.Clause{ |
nothing calls this directly
no test coverage detected