Add sharness tests for cat offset command
License: MIT Signed-off-by: ForrestWeston <forrest@protocol.ai>
ForrestWeston committed
Jan 2, 2018 at 09:57 UTC
8a8c9b507bf541e494989065a673ae5cff9c1f42
1 file changed
+33
test/sharness/t0040-add-and-cat.sh
+33
@@ -46,11 +46,44 @@ test_add_cat_file() {
46
test_cmp expected actual
47
'
48
49
+ test_expect_success "ipfs cat with offset succeeds" '
50
+ ipfs cat --offset 10 "$HASH" >actual
51
+ '
52
+
53
+ test_expect_success "ipfs cat from offset output looks good" '
54
+ echo "ds!" >expected &&
55
+ test_cmp expected actual
56
+ '
57
+
58
+ test_expect_success "ipfs cat multiple hashes with offset succeeds" '
59
+ ipfs cat --offset 10 "$HASH" "$HASH" >actual
60
+ '
61
+
62
+ test_expect_success "ipfs cat from offset output looks good" '
63
+ echo "ds!" >expected &&
64
+ echo "Hello Worlds!" >>expected &&
65
+ test_cmp expected actual
66
+ '
67
+
68
+ test_expect_success "ipfs cat multiple hashes with offset succeeds" '
69
+ ipfs cat --offset 16 "$HASH" "$HASH" >actual
70
+ '
71
+
72
+ test_expect_success "ipfs cat from offset output looks good" '
73
+ echo "llo Worlds!" >expected &&
74
+ test_cmp expected actual
75
+ '
76
+
77
+ test_expect_success "ipfs cat from negitive offset should fail" '
78
+ test_expect_code 1 ipfs cat --offset -102 "$HASH" > actual
79
+ '
80
+
81
test_expect_success "ipfs cat /ipfs/file succeeds" '
82
ipfs cat /ipfs/$HASH >actual
83
'
84
85
test_expect_success "output looks good" '
86
+ echo "Hello Worlds!" >expected &&
87
test_cmp expected actual
88
'
89