got all tests passing for js and changed order of test gen templates

This commit is contained in:
parrt 2015-06-16 16:16:16 -07:00
parent 21740a48b6
commit ad0239fb32
3 changed files with 56 additions and 51 deletions

21
bild.py
View File

@ -68,11 +68,7 @@ RUNTIME_TEST_TEMPLATES = {
"CSharp" : uniformpath(CSHARP_TARGET)+"/tool/test/org/antlr/v4/test/runtime/csharp/CSharp.test.stg",
"Python2" : uniformpath(PYTHON2_TARGET)+"/tool/test/org/antlr/v4/test/runtime/python2/Python2.test.stg",
"Python3" : uniformpath(PYTHON3_TARGET)+"/tool/test/org/antlr/v4/test/runtime/python3/Python3.test.stg",
# "NodeJS" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/node/NodeJS.test.stg",
# "Safari" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/safari/Safari.test.stg",
# "Firefox" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/firefox/Firefox.test.stg",
# "Chrome" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/chrome/Chrome.test.stg",
# "Explorer" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/rt/js/explorer/Explorer.test.stg"
"JavaScript" : uniformpath(JAVASCRIPT_TARGET)+"/tool/test/org/antlr/v4/test/runtime/javascript/node/Node.test.stg",
}
@ -108,8 +104,13 @@ def compile():
# Special case: python2 needs code from python3
javac(uniformpath(TARGETS['Python3'])+"/tool/test/org/antlr/v4/test/runtime/python2/BasePythonTest.java",
"out", version="1.6", cp=cp, args=args)
skip = ['org/antlr/v4/test/rt',
'org/antlr/v4/test/runtime/javascript/chrome',
'org/antlr/v4/test/runtime/javascript/explorer',
'org/antlr/v4/test/runtime/javascript/firefox',
'org/antlr/v4/test/runtime/javascript/safari']
for t in RUNTIME_TEST_TEMPLATES:
javac(TARGETS[t] + "/tool/test", "out", version="1.6", cp=cp, args=args, skip=['org/antlr/v4/test/rt'])
javac(TARGETS[t] + "/tool/test", "out", version="1.6", cp=cp, args=args, skip=skip)
javac('gen/test/'+t, "out", version="1.6", cp=cp, args=args)
@ -337,17 +338,11 @@ def test(target, juprops, args):
if target=='Java':
# don't test generator
skip = [ "TestPerformance.java", "TestGenerator.java" ]
elif target=='Python2':
# need BasePythonTest located in python3 target
# base = uniformpath(TARGETS['Python3'] + "/tool/test")
# skip = [ "/org/antlr/v4/test/runtime/python3/" ]
# javac(base+"/tool/test/org/antlr/v4/test/runtime/python2/BasePythonTest.java",
# "out/test/"+target, version="1.6", cp=thisjarwithjunit, args=args, skip=skip)
skip = []
elif target=='JavaScript':
# don't test browsers automatically, this is overkill and unreliable
browsers = ["safari","chrome","firefox","explorer"]
skip = [ uniformpath(srcdir + "/org/antlr/v4/test/rt/js/" + b) for b in browsers ]
skip += [ uniformpath(srcdir + "/org/antlr/v4/test/runtime/javascript/" + b) for b in browsers ]
javac(srcdir, trgdir="out/test/"+target, version="1.6", cp=thisjarwithjunit, args=args, skip=skip)
# copy any resource files required for testing
for t in TARGETS:

View File

@ -53,40 +53,6 @@ CompositeLexerTestMethod(test) ::= <<
<LexerTestMethod(test)>
>>
testAnnotations(test) ::= <%
@Test
<if(test.Options.("Ignore"))>
<\n>@Ignore(<writeStringLiteral(test.Options.("Ignore"))>)
<elseif(IgnoredTests.(({<file.name>.<test.name>})))>
<\n>@Ignore(<writeStringLiteral(IgnoredTests.(({<file.name>.<test.name>})))>)
<endif>
%>
writeBoolean(o) ::= "<if(o && !isEmpty.(o))>true<else>false<endif>"
buildStringLiteral(text, variable) ::= <<
StringBuilder <variable>Builder = new StringBuilder(<strlen.(text)>);
<lines.(text):{line|<variable>Builder.append("<escape.(line)>");}; separator="\n">
String <variable> = <variable>Builder.toString();
>>
writeStringLiteral(text) ::= <%
<if(isEmpty.(text))>
""
<else>
<writeLines(lines.(text))>
<endif>
%>
writeLines(textLines) ::= <%
<if(rest(textLines))>
<textLines:{line|
<\n> "<escape.(line)>}; separator="\" +">"
<else>
"<escape.(first(textLines))>"
<endif>
%>
ParserTestMethod(test) ::= <<
<testAnnotations(test)>
public void test<test.name>() throws Exception {
@ -118,10 +84,6 @@ public void test<test.name>() throws Exception {
>>
string(text) ::= <<
"<escape.(text)>"
>>
CompositeParserTestMethod(test) ::= <<
<ParserTestMethod(test)>
>>
@ -148,6 +110,44 @@ public void test<test.name>() throws Exception {
>>
testAnnotations(test) ::= <%
@Test
<if(test.Options.("Ignore"))>
<\n>@Ignore(<writeStringLiteral(test.Options.("Ignore"))>)
<elseif(IgnoredTests.(({<file.name>.<test.name>})))>
<\n>@Ignore(<writeStringLiteral(IgnoredTests.(({<file.name>.<test.name>})))>)
<endif>
%>
buildStringLiteral(text, variable) ::= <<
StringBuilder <variable>Builder = new StringBuilder(<strlen.(text)>);
<lines.(text):{line|<variable>Builder.append("<escape.(line)>");}; separator="\n">
String <variable> = <variable>Builder.toString();
>>
writeStringLiteral(text) ::= <%
<if(isEmpty.(text))>
""
<else>
<writeLines(lines.(text))>
<endif>
%>
writeLines(textLines) ::= <%
<if(rest(textLines))>
<textLines:{line|
<\n> "<escape.(line)>}; separator="\" +">"
<else>
"<escape.(first(textLines))>"
<endif>
%>
string(text) ::= <<
"<escape.(text)>"
>>
writeBoolean(o) ::= "<if(o && !isEmpty.(o))>true<else>false<endif>"
writeln(s) ::= <<System.out.println(<s>);>>
write(s) ::= <<System.out.print(<s>);>>

View File

@ -21,6 +21,7 @@
<sourceFolder url="file://$MODULE_DIR$/../gen/test/Java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../gen/test/Python3" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../gen/test/Python2" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../gen/test/JavaScript" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../.idea" />
<excludeFolder url="file://$MODULE_DIR$/../antlr4-maven-plugin" />
<excludeFolder url="file://$MODULE_DIR$/../runtime" />
@ -34,6 +35,15 @@
<content url="file://$MODULE_DIR$/../../antlr4-csharp/tool/test">
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-csharp/tool/test" isTestSource="false" />
</content>
<content url="file://$MODULE_DIR$/../../antlr4-javascript">
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test/org/antlr/v4/test/rt" />
<excludeFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test/org/antlr/v4/test/runtime/javascript/chrome" />
<excludeFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test/org/antlr/v4/test/runtime/javascript/explorer" />
<excludeFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test/org/antlr/v4/test/runtime/javascript/firefox" />
<excludeFolder url="file://$MODULE_DIR$/../../antlr4-javascript/tool/test/org/antlr/v4/test/runtime/javascript/safari" />
</content>
<content url="file://$MODULE_DIR$/../../antlr4-python2">
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-python2/tool/test" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../antlr4-python2/tool/src" isTestSource="false" />