Fix bugs in assertGrep and a rhizome test case

This commit is contained in:
Andrew Bettison 2012-04-10 18:09:52 +09:30
parent 6988fb7dd9
commit 51b5cf8b54
2 changed files with 5 additions and 6 deletions

View File

@ -299,8 +299,7 @@ assertGrep() {
_tfw_error "incorrect arguments"
return 254
fi
_tfw_assert_grep "$1" "$1" "$2"
return 0
_tfw_assert_grep "$1" "$1" "$2" || _tfw_failexit
}
# Internal (private) functions that are not to be invoked directly from test

View File

@ -40,7 +40,7 @@ setup_AddManifest() {
setup_dna
assert_rhizome_list_empty
echo "A test file" >file1
echo >file1.manifest
echo 'name=wah' >file1.manifest
echo "Another test file" >file2
}
test_AddManifest() {
@ -49,13 +49,13 @@ test_AddManifest() {
tfw_cat --stdout
tfw_cat --stderr
tfw_cat -v file1.manifest
assertGrep file1.manifest '^name="file1"$'
assertGrep file1.manifest '^name=wah$'
assertGrep file1.manifest '^date=[0-9]\+$'
assertGrep file1.manifest '^version=[0-9]\+$'
assertGrep file1.manifest '^id=[0-9a-fA-F]\+$'
assertGrep file1.manifest "^filesize=$(wc --bytes file1)\$"
assertGrep file1.manifest "^filesize=$(cat file1 | wc --bytes)\$"
assertGrep file1.manifest "^first_byte=0$"
assertGrep file1.manifest "^last_byte=$(wc --bytes file1)\$"
assertGrep file1.manifest "^last_byte=$(cat file1 | wc --bytes)\$"
}
doc_AddThenList="Rhizome list contains one file after one add"