]> git.phdru.name Git - ppu.git/blobdiff - tests/test_rm.py
Add option -r for rm.py
[ppu.git] / tests / test_rm.py
index 631502cfe096c4531cfd2f80364bbcaafa4f8662..4e4cd76d314412f7fc2c1215f3832965aa0a73f4 100755 (executable)
@@ -21,3 +21,22 @@ def test_rm():
         [sys.executable, test_prog_path, "test2"]) == 0
     assert_files_exist('test1')
     assert_files_not_exist('test2')
+
+    create_files(['test1', 'test2'])
+    assert_files_exist(['test1', 'test2'])
+    assert subprocess.call(
+        [sys.executable, test_prog_path, "-r", "test2"]) == 0
+    assert_files_exist('test1')
+    assert_files_not_exist('test2')
+
+
+def test_rm_recursive():
+    create_files(['test'])
+    create_files(['test'], 'subdir/subd2')
+    assert_files_exist(['test', 'subdir/subd2/test'])
+    assert subprocess.call(
+        [sys.executable, test_prog_path, "subdir"]) == 1
+    assert subprocess.call(
+        [sys.executable, test_prog_path, "-r", "subdir"]) == 0
+    assert_files_exist('test')
+    assert_files_not_exist(['subdir/subd2/test'])