shithub: scc

Download patch

ref: e2fe38d6738c7d231fd926a36a0b1e173af7f2d2
parent: 7726d04d20291674f962bfcb5cc494934a762ff2
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Feb 19 12:00:52 EST 2018

[tests/ar] First version of the test for -p

It is known that this test has some problems.

--- /dev/null
+++ b/tests/ar/execute/20-test-p.sh
@@ -1,0 +1,65 @@
+#!/bin/sh
+
+exec >> test.log 2>&1
+
+
+set -e
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+trap "rm -f file.a" 0 2 3
+
+echo tmp1=$tmp1 and tmp2=$tmp2
+
+############################################################################
+#print 1st member
+
+cp master.a file.a
+
+ar -p file.a file1 > $tmp1
+
+cat <<! > $tmp2
+This is the first file,
+and it should go in the
+first position in the archive.
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print 3rd member
+
+ar -p file.a file3 > $tmp1
+
+cat <<! > $tmp2
+But this other one is the second one,
+and it shouldn't go in the first position
+because it should go in the second position.
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print all members
+
+ar -p file.a file1 file2 file3 >$tmp1
+
+cat <<! > $tmp2
+This is the first file,
+and it should go in the
+first position in the archive.
+But this other one is the second one,
+and it shouldn't go in the first position
+because it should go in the second position.
+and at the end, this is the last file
+that should go at the end of the file,
+thus it should go in the third position.
+!
+
+cmp $tmp1 $tmp2
+
+#and now with no members in command line
+
+ar -p file.a > $tmp1
+
+cmp $tmp1 $tmp2