]> source.dussan.org Git - aspectj.git/commitdiff
tests for new java run fork attributes
authorwisberg <wisberg>
Wed, 6 Oct 2004 08:40:36 +0000 (08:40 +0000)
committerwisberg <wisberg>
Wed, 6 Oct 2004 08:40:36 +0000 (08:40 +0000)
tests/ajcHarnessTests.xml
tests/harness/SystemPropertiesTest.java [new file with mode: 0644]

index d3534b01d3b6c1137ff9bf814ec18ce9c574d101..56c098a38b9529196676410e78ec3140cbd645a4 100644 (file)
             <dir-changes updated="Removed"/>
                </inc-compile>
     </ajc-test>
+       
+    <ajc-test dir="harness"
+       keywords="expect-fail"
+               title="fail not forking or setting property">
+        <compile files="SystemPropertiesTest.java"/>
+        <run class="SystemPropertiesTest" fork="false"/>
+    </ajc-test>
+
+    <ajc-test dir="harness"
+       keywords="expect-fail"
+               title="fail fork without setting property">
+        <compile files="SystemPropertiesTest.java"/>
+        <run class="SystemPropertiesTest" fork="true"/>
+    </ajc-test>
+
+    <ajc-test dir="harness"
+               title="pass fork and set property">
+        <compile files="SystemPropertiesTest.java"/>
+        <run class="SystemPropertiesTest" 
+               fork="true" 
+               vmargs="-DPASS=true,-Dname=value"/>
+    </ajc-test>
 
 </suite>
 
diff --git a/tests/harness/SystemPropertiesTest.java b/tests/harness/SystemPropertiesTest.java
new file mode 100644 (file)
index 0000000..d02985f
--- /dev/null
@@ -0,0 +1,15 @@
+
+public class SystemPropertiesTest {
+    public static void main(String[] args) {        
+        boolean pass = Boolean.getBoolean("PASS");
+        if (!pass) {
+            throw new Error("failed to get Boolean \\\"PASS\\\"");
+        }
+        String value = System.getProperty("name", null);
+        if (!"value".equals(value)) {
+            throw new Error("failed to get name=\"value\": " + value);
+        }
+    }
+}
+
+