Add test to detect invalid path

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht 2015-07-03 08:49:06 +07:00
parent dfde18e124
commit 44245fe015
2 changed files with 10 additions and 0 deletions

View File

@ -24,4 +24,8 @@ func TestResolveNoComponents(t *testing.T) {
t.Fatal("Should error with no components (/ipfs/).", err)
}
_, err = core.Resolve(n.Context(), n, path.Path("/../.."))
if err != path.ErrBadPath {
t.Fatal("Should error with invalid path.", err)
}
}

View File

@ -112,6 +112,12 @@ test_get_cmd() {
test_cmp dir/b/c "$HASH2"/b/c &&
rm -r "$HASH2"
'
test_expect_success "ipfs get ../.. should fail" '
echo "Error: invalid ipfs ref path" >expected &&
test_must_fail ipfs get ../.. 2>actual &&
test_cmp expected actual
'
}
# should work offline