diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-29 15:55:53 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-05-29 15:55:53 +0900 |
commit | 1ebed922b8c642b6ff4cec71820f24ceeb331c18 (patch) | |
tree | 08b71e6330b418d3d263264193262f489bba29b5 /tester/tester.go | |
parent | Add vartan-test command (diff) | |
download | urubu-1ebed922b8c642b6ff4cec71820f24ceeb331c18.tar.gz urubu-1ebed922b8c642b6ff4cec71820f24ceeb331c18.tar.xz |
Support testable tree output in vartan-parse command
Diffstat (limited to 'tester/tester.go')
-rw-r--r-- | tester/tester.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tester/tester.go b/tester/tester.go index ef3ca61..70d4800 100644 --- a/tester/tester.go +++ b/tester/tester.go @@ -152,7 +152,7 @@ func runTest(g *gspec.CompiledGrammar, c *TestCaseWithMetadata) *TestResult { } // When a parse tree exists, the test continues regardless of whether or not syntax errors occurred. - diffs := tspec.DiffTree(genTree(tb.Tree()).Fill(), c.TestCase.Output) + diffs := tspec.DiffTree(ConvertSyntaxTreeToTestableTree(tb.Tree()).Fill(), c.TestCase.Output) if len(diffs) > 0 { return &TestResult{ TestCasePath: c.FilePath, @@ -165,12 +165,12 @@ func runTest(g *gspec.CompiledGrammar, c *TestCaseWithMetadata) *TestResult { } } -func genTree(dTree *driver.Node) *tspec.Tree { +func ConvertSyntaxTreeToTestableTree(dTree *driver.Node) *tspec.Tree { var children []*tspec.Tree if len(dTree.Children) > 0 { children = make([]*tspec.Tree, len(dTree.Children)) for i, c := range dTree.Children { - children[i] = genTree(c) + children[i] = ConvertSyntaxTreeToTestableTree(c) } } return tspec.NewTree(dTree.KindName, children...) |