Skip to content

Commit 03186b5

Browse files
author
aq17
committed
Add synced PCL files to program gen tests
1 parent edec67d commit 03186b5

File tree

32 files changed

+2188068
-153
lines changed

32 files changed

+2188068
-153
lines changed

pkg/codegen/java/gen_program_test.go

+33-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,46 @@ type PclTestFile struct {
1616
}
1717

1818
var testdataPath = filepath.Join("..", "testing", "test", "testdata")
19+
var transpiledExamplesDir = "transpiled_examples"
20+
21+
var skipGenerationTests = []string{
22+
"azure-container-apps",
23+
"getting-started",
24+
"pulumi-variable",
25+
}
26+
27+
func skipGeneration(test string) bool {
28+
for _, t := range skipGenerationTests {
29+
if t == test {
30+
return true
31+
}
32+
}
33+
return false
34+
}
1935

2036
func TestGenerateJavaProgram(t *testing.T) {
2137
t.Parallel()
2238

23-
files, err := ioutil.ReadDir(testdataPath)
39+
files, err := os.ReadDir(testdataPath)
2440
assert.NoError(t, err)
2541
tests := make([]test.ProgramTest, 0, len(files))
2642
for _, f := range files {
2743
name := f.Name()
44+
if f.IsDir() && name == transpiledExamplesDir {
45+
syncDir := filepath.Join(testdataPath, transpiledExamplesDir)
46+
files, err := os.ReadDir(syncDir)
47+
assert.NoError(t, err)
48+
for _, f := range files {
49+
name := strings.TrimSuffix(f.Name(), "-pp")
50+
if skipGeneration(name) {
51+
continue
52+
}
53+
tests = append(tests, test.ProgramTest{
54+
Directory: filepath.Join(transpiledExamplesDir, name),
55+
})
56+
}
57+
continue
58+
}
2859
if !strings.HasSuffix(name, "-pp") {
2960
continue
3061
}

0 commit comments

Comments
 (0)