3 [ -f testing.sh ] && . testing.sh
5 #testing "name" "command" "result" "infile" "stdin"
8 testcmd "/-only" "///////" "/\n" "" ""
9 testcmd "trailing /" "a//////" "a\n" "" ""
10 testcmd "combined" "/////a///b///c///d/////" "d\n" "" ""
12 # Standard suffix behavior.
13 testcmd "suffix" "a/b/c/d.suffix .suffix" "d\n" "" ""
15 # A suffix cannot be the entire result.
16 testcmd "suffix=result" ".txt .txt" ".txt\n" "" ""
18 # Deal with suffix appearing in the filename
19 testcmd "reappearing suffix 1" "a.txt.txt .txt" "a.txt\n" "" ""
20 testcmd "reappearing suffix 2" "a.txt.old .txt" "a.txt.old\n" "" ""
22 # A suffix should be a real suffix, only a the end.
23 testcmd "invalid suffix" "isthisasuffix? suffix" "isthisasuffix?\n" "" ""
26 testcmd "zero-length suffix" "a/b/c ''" "c\n" "" ""