1#!/bin/bash 2 3[ -f testing.sh ] && . testing.sh 4 5#testing "name" "command" "result" "infile" "stdin" 6 7# Removal of extra /'s 8testcmd "/-only" "///////" "/\n" "" "" 9testcmd "trailing /" "a//////" "a\n" "" "" 10testcmd "combined" "/////a///b///c///d/////" "d\n" "" "" 11 12# Standard suffix behavior. 13testcmd "suffix" "a/b/c/d.suffix .suffix" "d\n" "" "" 14 15# A suffix cannot be the entire result. 16testcmd "suffix=result" ".txt .txt" ".txt\n" "" "" 17 18# Deal with suffix appearing in the filename 19testcmd "reappearing suffix 1" "a.txt.txt .txt" "a.txt\n" "" "" 20testcmd "reappearing suffix 2" "a.txt.old .txt" "a.txt.old\n" "" "" 21 22# A suffix should be a real suffix, only a the end. 23testcmd "invalid suffix" "isthisasuffix? suffix" "isthisasuffix?\n" "" "" 24 25# Zero-length suffix 26testcmd "zero-length suffix" "a/b/c ''" "c\n" "" "" 27 28# -s. 29testcmd "-s" "-s .txt /a/b/c.txt" "c\n" "" "" 30testcmd "-s implies -a" "-s .txt /a/b/c.txt /a/b/d.txt" "c\nd\n" "" "" 31testcmd "-a" "-a /a/b/f1 /c/d/f2" "f1\nf2\n" "" "" 32