Skip to content

Commit

Permalink
Create a new compiler instance for each test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
markkurossi committed Jun 13, 2024
1 parent 7af5e4c commit bf1eb25
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var (
func TestSuite(t *testing.T) {
params := utils.NewParams()
params.MPCLCErrorLoc = true
compiler := compiler.New(params)

filepath.WalkDir(testsuite,
func(path string, d fs.DirEntry, err error) error {
Expand All @@ -45,16 +44,16 @@ func TestSuite(t *testing.T) {
if d.IsDir() {
return nil
}
testFile(t, compiler, path)
testFile(t, compiler.New(params), path)
return nil
})
}

func testFile(t *testing.T, compiler *compiler.Compiler, file string) {
func testFile(t *testing.T, cc *compiler.Compiler, file string) {
if !strings.HasSuffix(file, ".mpcl") {
return
}
pkg, err := compiler.ParseFile(file)
pkg, err := cc.ParseFile(file)
if err != nil {
t.Errorf("failed to parse '%s': %s", file, err)
return
Expand Down Expand Up @@ -147,7 +146,7 @@ func testFile(t *testing.T, compiler *compiler.Compiler, file string) {
}
inputSizes = append(inputSizes, sizes)
}
circ, _, err := compiler.CompileFile(file, inputSizes)
circ, _, err := cc.CompileFile(file, inputSizes)
if err != nil {
t.Errorf("failed to compile '%s': %s", file, err)
return
Expand Down

0 comments on commit bf1eb25

Please sign in to comment.