From 4cda4d1a70ab96c927a438c173baf8d7a2a474b4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Oct 2017 19:19:27 +0200 Subject: Add more tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- test | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test b/test index 14d9ede..c07ca31 100755 --- a/test +++ b/test @@ -40,7 +40,7 @@ simple_test d /dev simple_test f /dev mkdir -p .testdir -touch .testdir/r .testdir/w .testdir/x .testdir/k .testdir/u .testdir/g +touch .testdir/r .testdir/w .testdir/x .testdir/k .testdir/u .testdir/g .testdir/rw printf x > .testdir/s chmod 100 .testdir/x chmod 200 .testdir/w @@ -48,6 +48,7 @@ chmod 400 .testdir/r chmod 1000 .testdir/k chmod 2000 .testdir/g chmod 4000 .testdir/u +chmod 600 .testdir/rw ln -s 'non existent file' .testdir/h mkfifo .testdir/p ./mksocket .testdir/S @@ -78,4 +79,27 @@ for f in 0 1 2 3 4 5 6 x y z; do fi done +! test -e 'non existent file' +test $(./xtest -e 'non existent file' | wc -l) = 0 +test $(./xtest +e 'non existent file' | wc -l) = 1 + +rm -rf .testdir +mkdir -p .testdir +for i in 0 1 2 3 4 5 6 7; do + touch .testdir/$i + chmod ${i}00 .testdir/$i +done + +test $(./xtest -r .testdir/* | wc -l) = 4 +test $(./xtest +r .testdir/* | wc -l) = 4 +test $(./xtest -w .testdir/* | wc -l) = 4 +test $(./xtest +w .testdir/* | wc -l) = 4 +test $(./xtest -x .testdir/* | wc -l) = 4 +test $(./xtest +x .testdir/* | wc -l) = 4 +test $(./xtest -r +r .testdir/* | wc -l) = 8 +test $(./xtest -w +w .testdir/* | wc -l) = 8 +test $(./xtest -x +x .testdir/* | wc -l) = 8 +test $(./xtest -rw .testdir/* | wc -l) = 6 +test $(./xtest -r .testdir/* | ./xtest -w | wc -l) = 2 + rm -rf .testdir -- cgit v1.2.3-70-g09d2