scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit a70327662183619906f80e32669eb536aa4e31fc
parent 48b4c60d6204b57e5e8bff3f17e2df8309b63b23
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 19 Feb 2018 16:23:20 +0000

[tests/ar] Add tests for -d

Diffstat:
Atests/ar/execute/10-test-d.sh | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+), 0 deletions(-)

diff --git a/tests/ar/execute/10-test-d.sh b/tests/ar/execute/10-test-d.sh @@ -0,0 +1,94 @@ +#!/bin/sh + +exec >> test.log 2>&1 + +set -e + +trap "rm -f file.a" 0 2 3 + +############################################################################ +#delete one member + +cp master.a file.a + +ar -dv file.a file2 + +if ar -tv file.a file2 +then + echo file-2 was not deleted >&2 + exit 1 +fi + + +############################################################################ +#delete two members, 1st and 2nd + +cp master.a file.a + +ar -dv file.a file1 file2 + +if ar -tv file.a file1 file2 +then + echo file-1 or file-2 were not deleted >&2 + exit 1 +fi + + +############################################################################ +#delete two members, 2nd and 3rd + +cp master.a file.a +ar -dv file.a file2 file3 + +if ar -tv file.a file2 file3 +then + echo file-2 file-3 were not deleted >&2 + exit 1 +fi + +############################################################################ +#remove all the members + +cp master.a file.a +ar -dv file.a file1 file2 file3 + +if ar -tv file.a file2 file3 +then + echo file-1 file2 file were not deleted >&2 + exit 1 +fi + +if test `ar -t file.a | wc -l` -ne 0 +then + echo file.a is not empty after deleting all the members >&2 + exit 1 +fi + +############################################################################ +#special cases + +#no members +cp master.a file.a + +last=`stat -c %Y file.a` + +if ! ar -dv file.a +then + echo ar returned with error when no members + exit 1 +fi + +if test `stat -c %Y file.a` -ne $last +then + echo empty ar -d modified the archive >&2 + exit 1 +fi + +#delete not existing member +cp master.a file.a + +if ar -dv file.a badfile +then + echo ar returned ok deleting a not existing member >&2 + exit 1 +fi