From 2a6c94abcb38a48f98c1393742a65232edc3c07f Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sun, 2 Dec 2018 15:35:44 +0100 Subject: Initial commit --- dirname.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 dirname.test (limited to 'dirname.test') diff --git a/dirname.test b/dirname.test new file mode 100755 index 0000000..3bc45ca --- /dev/null +++ b/dirname.test @@ -0,0 +1,20 @@ +#!/bin/sh + +. ./test-common.sh + +# "test name" "command to execute" "expected output" +check_stdout "dirname-noarg" "../dirname" "" && \ +check_stderr "dirname-noarg-stderr" "../dirname" "usage: ../dirname path\n" && \ +check_stdout "dirname-non-existing" "../dirname a b c" "" && \ +check_stdout "dirname-slash" "../dirname /" "/\n" && \ +check_stdout "dirname-dashes-slash" "../dirname -- /" "/\n" && \ +check_stdout "dirname-dashes-slash-a" "../dirname -- /a" "/\n" && \ +check_stdout "dirname-doublequotes" "../dirname \"\"" ".\n" && \ +check_stdout "dirname-slashes" "../dirname ///" "/\n" && \ +check_stdout "dirname-a/b" "../dirname a/b" "a\n" && \ +check_stdout "dirname-a/b/" "../dirname a/b/" "a\n" && \ +check_stdout "dirname-a/b//" "../dirname a/b//" "a\n" && \ +check_stdout "dirname-a" "../dirname a" ".\n" && \ +check_stdout "dirname-a/" "../dirname a/" ".\n" && \ +check_stdout "dirname-/a/b/c" "../dirname /a/b/c" "/a/b\n" && \ +check_stdout "dirname-//a/b/c" "../dirname //a/b/c" "//a/b\n" -- cgit v1.2.1-18-gbd029