Mercurial > hg > toybox
view scripts/test/basename.test @ 678:ae3455c2989b
Update roadmap/status with new toolbox analysis based on android system/core git repo.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 16 Oct 2012 17:09:30 -0500 |
parents | dd24f86d5ad5 |
children | 786841fdb1e0 |
line wrap: on
line source
#!/bin/bash [ -f testing.sh ] && . testing.sh #testing "name" "command" "result" "infile" "stdin" # Removal of extra /'s testing "basename /-only" "basename ///////" "/\n" "" "" testing "basename trailing /" "basename a//////" "a\n" "" "" testing "basename combined" "basename /////a///b///c///d/////" "d\n" "" "" # Standard suffix behavior. testing "basename suffix" "basename a/b/c/d.suffix .suffix" "d\n" "" "" # A suffix cannot be the entire result. testing "basename suffix=result" "basename .txt .txt" ".txt\n" "" "" # Deal with suffix appearing in the filename testing "basename reappearing suffix 1" "basename a.txt.txt .txt" "a.txt\n" "" "" testing "basename reappearing suffix 2" "basename a.txt.old .txt" "a.txt.old\n" "" "" # A suffix should be a real suffix, only a the end. testing "basename invalid suffix" "basename isthisasuffix? suffix" "isthisasuffix?\n" "" ""