Skip to content

Commit f6e215a

Browse files
author
aq17
committed
Add synced PCL files to program gen tests
1 parent 1fcda12 commit f6e215a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pkg/codegen/java/gen_program_test.go

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package java
22

33
import (
4-
"io/ioutil"
4+
"os"
55
"path/filepath"
66
"strings"
77
"testing"
@@ -16,15 +16,26 @@ type PclTestFile struct {
1616
}
1717

1818
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
19+
var transpiledExamplesDir = "transpiled_examples"
1920

2021
func TestGenerateJavaProgram(t *testing.T) {
2122
t.Parallel()
2223

23-
files, err := ioutil.ReadDir(testdataPath)
24+
files, err := os.ReadDir(testdataPath)
2425
assert.NoError(t, err)
2526
tests := make([]test.ProgramTest, 0, len(files))
2627
for _, f := range files {
2728
name := f.Name()
29+
if f.IsDir() && name == transpiledExamplesDir {
30+
syncDir := filepath.Join(testdataPath, transpiledExamplesDir)
31+
files, err := os.ReadDir(syncDir)
32+
assert.NoError(t, err)
33+
for _, f := range files {
34+
tests = append(tests, test.ProgramTest{
35+
Directory: strings.TrimSuffix(f.Name(), "-pp"),
36+
})
37+
}
38+
}
2839
if !strings.HasSuffix(name, "-pp") {
2940
continue
3041
}

0 commit comments

Comments
 (0)