summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/JavaCommonTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Tool/JavaCommonTests.py')
-rw-r--r--src/engine/SCons/Tool/JavaCommonTests.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py
index 4a7f9cf..853afd4 100644
--- a/src/engine/SCons/Tool/JavaCommonTests.py
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
@@ -286,6 +286,50 @@ public abstract class TestClass
assert classes == ['TestClass$1', 'TestClass$2', 'TestClass'], classes
+ def test_closing_bracket(self):
+ """Test finding a closing bracket instead of an anonymous class"""
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+class TestSCons {
+ public static void main(String[] args) {
+ Foo[] fooArray = new Foo[] { new Foo() };
+ }
+}
+
+class Foo { }
+""")
+ assert pkg_dir == None, pkg_dir
+ assert classes == ['TestSCons', 'Foo'], classes
+
+
+ def test_dot_class_attributes(self):
+ """Test handling ".class" attributes"""
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+public class Test extends Object
+{
+ static {
+ Class c = Object[].class;
+ Object[] s = new Object[] {};
+ }
+}
+""")
+ assert classes == ['Test'], classes
+
+ pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
+public class A {
+ public class B {
+ public void F(Object[] o) {
+ F(new Object[] {Object[].class});
+ }
+ public void G(Object[] o) {
+ F(new Object[] {});
+ }
+ }
+}
+""")
+ assert pkg_dir == None, pkg_dir
+ assert classes == ['A$B', 'A'], classes
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()