1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-28 17:03:58 +08:00

Merge pull request #4114 from ipfs/fix/add-pipe-error-test

sharness: fix the 'useful error message when adding a named pipe' test
This commit is contained in:
Jeromy Johnson
2017-08-01 00:05:13 -07:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@ -364,7 +364,7 @@ generic_stat() {
_STAT="stat -f %Sp"
;;
esac
$_STAT "$1"
$_STAT "$1" || echo "failed" # Avoid returning nothing.
}
test_check_peerid() {

View File

@ -192,8 +192,9 @@ test_add_named_pipe() {
test_expect_success "useful error message when adding a named pipe" '
mkfifo named-pipe &&
test_expect_code 1 ipfs add named-pipe 2>actual &&
STAT=$(generic_stat named-pipe) &&
rm named-pipe &&
grep "Error: Unrecognized file type for named-pipe: $(generic_stat named-pipe)" actual &&
grep "Error: Unrecognized file type for named-pipe: $STAT" actual &&
grep USAGE actual &&
grep "ipfs add" actual
'
@ -201,8 +202,9 @@ test_add_named_pipe() {
test_expect_success "useful error message when recursively adding a named pipe" '
mkdir -p named-pipe-dir &&
mkfifo named-pipe-dir/named-pipe &&
STAT=$(generic_stat named-pipe-dir/named-pipe) &&
test_expect_code 1 ipfs add -r named-pipe-dir 2>actual &&
printf "Error:$err_prefix Unrecognized file type for named-pipe-dir/named-pipe: $(generic_stat named-pipe-dir/named-pipe)\n" >expected &&
printf "Error:$err_prefix Unrecognized file type for named-pipe-dir/named-pipe: $STAT\n" >expected &&
rm named-pipe-dir/named-pipe &&
rmdir named-pipe-dir &&
test_cmp expected actual