You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by li...@apache.org on 2006/11/18 16:05:21 UTC

svn commit: r476534 - in /harmony/enhanced/classlib/trunk: modules/luni/src/test/java/tests/api/java/io/FileTest.java support/src/test/java/tests/support/Support_DeleteOnExitTest.java

Author: liangyx
Date: Sat Nov 18 07:05:20 2006
New Revision: 476534

URL: http://svn.apache.org/viewvc?view=rev&rev=476534
Log:
add regression test for HARMONY-2156

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
    harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java?view=diff&rev=476534&r1=476533&r2=476534
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java Sat Nov 18 07:05:20 2006
@@ -29,6 +29,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
+import tests.support.Support_Exec;
 import tests.support.Support_PlatformFile;
 
 public class FileTest extends junit.framework.TestCase {
@@ -2158,7 +2159,26 @@
 			fail("Unexpected MalformedURLException," + e);
 		}
 	}
-
+    
+    /**
+     * @tests java.io.File#deleteOnExit()
+     */
+    public void test_deleteOnExit() throws IOException, InterruptedException {
+        File dir = new File("dir4filetest");
+        dir.mkdir();
+        assertTrue(dir.exists());
+        File subDir = new File("dir4filetest/subdir");
+        subDir.mkdir();
+        assertTrue(subDir.exists());
+
+        Support_Exec.execJava(new String[] {
+                "tests.support.Support_DeleteOnExitTest",
+                dir.getAbsolutePath(), subDir.getAbsolutePath() },
+                new String[] {}, false);
+        assertFalse(dir.exists());
+        assertFalse(subDir.exists());
+    }
+    
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.

Modified: harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java?view=diff&rev=476534&r1=476533&r2=476534
==============================================================================
--- harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java (original)
+++ harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DeleteOnExitTest.java Sat Nov 18 07:05:20 2006
@@ -22,7 +22,9 @@
 public class Support_DeleteOnExitTest {
 
 	public static void main(java.lang.String[] args) {
-		File f1 = new File(args[0]);
-		f1.deleteOnExit();
-	}
+        for (int i = 0; i < args.length; i++) {
+            File f1 = new File(args[i]);
+            f1.deleteOnExit();
+        }
+    }
 }