ref: cae2ba88da6187ba4ad78e2493d161fd4a3129b7
parent: db3d99c72d9ae5d3d30357bba2251db3008f71ef
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 19 13:27:19 EST 2018
[tests/ar] Add tests for -t
--- /dev/null
+++ b/tests/ar/execute/30-test-t.sh
@@ -1,0 +1,63 @@
+#!/bin/sh
+
+exec >> test.log 2>&1
+set -e
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+trap "rm -f file.a $tmp1 $tmp2" 0 2 3
+
+
+############################################################################
+#list 1st member
+
+cp master.a file.a
+
+ar -t file.a file1 > $tmp1
+
+cat <<! > $tmp2
+file1
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print 3rd member
+
+ar -t file.a file3 > $tmp1
+
+cat <<! > $tmp2
+file3
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print 2nd member with verbose
+
+ar -tv file.a file2 >$tmp1
+
+cat <<! > $tmp2
+rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print all members
+
+ar -t file.a file1 file2 file3 >$tmp1
+
+cat <<! > $tmp2
+file1
+file2
+file3
+!
+
+cmp $tmp1 $tmp2
+
+#and now with no members in command line
+
+ar -t file.a > $tmp1
+
+cmp $tmp1 $tmp2