Skip to content

Commit

Permalink
Add synced PCL files to program gen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aq17 committed Oct 18, 2022
1 parent 1fcda12 commit f6e215a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/codegen/java/gen_program_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package java

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
Expand All @@ -16,15 +16,26 @@ type PclTestFile struct {
}

var testdataPath = filepath.Join("..", "testing", "test", "testdata")
var transpiledExamplesDir = "transpiled_examples"

func TestGenerateJavaProgram(t *testing.T) {
t.Parallel()

files, err := ioutil.ReadDir(testdataPath)
files, err := os.ReadDir(testdataPath)
assert.NoError(t, err)
tests := make([]test.ProgramTest, 0, len(files))
for _, f := range files {
name := f.Name()
if f.IsDir() && name == transpiledExamplesDir {
syncDir := filepath.Join(testdataPath, transpiledExamplesDir)
files, err := os.ReadDir(syncDir)
assert.NoError(t, err)
for _, f := range files {
tests = append(tests, test.ProgramTest{
Directory: strings.TrimSuffix(f.Name(), "-pp"),
})
}
}
if !strings.HasSuffix(name, "-pp") {
continue
}
Expand Down

0 comments on commit f6e215a

Please sign in to comment.