OSDN Git Service

* tests/lha-test9: added tests for overriding files.
authorarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sat, 22 Jun 2002 18:03:09 +0000 (18:03 +0000)
committerarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sat, 22 Jun 2002 18:03:09 +0000 (18:03 +0000)
* tests/lha-test.in: added test9.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@234 6a8cc165-1e22-0410-a132-eb4e3f353aba

tests/lha-test.in
tests/lha-test9 [new file with mode: 0644]

index 8a76046..b47fce4 100644 (file)
@@ -87,5 +87,6 @@ test -f test-1/test-c
 # . $srcdir/lha-test6; cleanup         # this feature was removed.
 . $srcdir/lha-test7; cleanup
 . $srcdir/lha-test8; cleanup
+. $srcdir/lha-test9; cleanup
 
 exit $result
diff --git a/tests/lha-test9 b/tests/lha-test9
new file mode 100644 (file)
index 0000000..4e68185
--- /dev/null
@@ -0,0 +1,62 @@
+# -*- shell-script -*-
+message 'testing extracting to existent files (this test need the Ruby interpreter)'
+
+pty()
+{
+  count=$1; shift
+  input=$1; shift  # y, n, a or s
+
+  ruby <<EOF
+    require 'pty'
+
+    inp, out, fd = PTY.getpty("$*")
+
+    th = Thread.start {
+      $count.times {
+       out.puts "$input"
+      }
+    }
+
+    loop {
+      begin
+       print inp.gets
+      rescue Errno::EIO
+      rescue PTY::ChildExited
+       # p [\$!, \$!.status, \$?]
+       exit \$!.status >> 8
+      end
+    }
+EOF
+}
+
+mkdir test-tmp &&
+echo foo > test-tmp/test-a &&
+echo bar > test-tmp/test-b &&
+echo baz > test-tmp/test-c &&
+cp -pr test-tmp test-tmp2  &&
+$lha c test-tmp.lzh test-tmp
+                                                       check $?
+$lha v test-tmp.lzh &&
+$lha v test-1.lzh
+                                                       check $?
+
+# skip file
+pty 3 n  $lha xw=test-tmp test-1.lzh
+                                                       check $?
+diff -r test-tmp test-tmp2
+                                                       check $?
+# overwrite
+pty 3 y  $lha xw=test-tmp test-1.lzh
+                                                       check $?
+diff -r test-1 test-tmp
+                                                       check $?
+# overwrite all
+pty 1 a  $lha x test-tmp.lzh
+                                                       check $?
+diff -r test-tmp test-tmp2
+                                                       check $?
+# skip all
+pty 1 s         $lha xw=test-tmp test-1.lzh
+                                                       check $?
+diff -r test-tmp test-tmp2
+                                                       check $?