huangcm
2025-08-25 f350412dc55c15118d0a7925d1071877498e5e24
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
 
[ -f testing.sh ] && . testing.sh
 
#testing "name" "command" "result" "infile" "stdin"
 
testing "/-only" "dirname ///////" "/\n" "" ""
testing "trailing /" "dirname a//////" ".\n" "" ""
testing "combined" "dirname /////a///b///c///d/////" "/////a///b///c\n" "" ""
testing "/a/" "dirname /////a///" "/\n" "" ""
testing "multiple" "dirname hello/a world/b" "hello\nworld\n" "" ""