@@ -40,6 +40,7 @@ var hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk"
40
40
var helloStr = "hello, world!"
41
41
42
42
// `echo -n | ipfs add`
43
+ var emptyFile = "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH"
43
44
44
45
func makeAPISwarm (ctx context.Context , fullIdentity bool , n int ) ([]* core.IpfsNode , []coreiface.CoreAPI , error ) {
45
46
mn := mocknet .New (ctx )
@@ -150,7 +151,7 @@ func TestAdd(t *testing.T) {
150
151
{
151
152
name : "addEmpty" ,
152
153
data : "" ,
153
- path : "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" ,
154
+ path : emptyFile ,
154
155
},
155
156
// CIDv1 version / rawLeaves
156
157
{
@@ -183,13 +184,25 @@ func TestAdd(t *testing.T) {
183
184
name : "addInline" ,
184
185
data : helloStr ,
185
186
path : "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv" ,
186
- opts : []options.UnixfsAddOption {options .Unixfs .InlineLimit (32 )},
187
+ opts : []options.UnixfsAddOption {options .Unixfs .Inline (true )},
188
+ },
189
+ {
190
+ name : "addInlineLimit" ,
191
+ data : helloStr ,
192
+ path : "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv" ,
193
+ opts : []options.UnixfsAddOption {options .Unixfs .InlineLimit (32 ), options .Unixfs .Inline (true )},
194
+ },
195
+ {
196
+ name : "addInlineZero" ,
197
+ data : "" ,
198
+ path : "/ipfs/z2yYDV" ,
199
+ opts : []options.UnixfsAddOption {options .Unixfs .InlineLimit (0 ), options .Unixfs .Inline (true ), options .Unixfs .RawLeaves (true )},
187
200
},
188
201
{ //TODO: after coreapi add is used in `ipfs add`, consider making this default for inline
189
202
name : "addInlineRaw" ,
190
203
data : helloStr ,
191
204
path : "/ipfs/zj7Gr8AcBreqGEfrnR5kPFe" ,
192
- opts : []options.UnixfsAddOption {options .Unixfs .InlineLimit (32 ), options .Unixfs .RawLeaves (true )},
205
+ opts : []options.UnixfsAddOption {options .Unixfs .InlineLimit (32 ), options .Unixfs .Inline ( true ), options . Unixfs . RawLeaves (true )},
193
206
},
194
207
// Chunker / Layout
195
208
{
@@ -312,7 +325,7 @@ func TestCatEmptyFile(t *testing.T) {
312
325
t .Fatal (err )
313
326
}
314
327
315
- emptyFilePath , err := coreiface .ParsePath ("/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" )
328
+ emptyFilePath , err := coreiface .ParsePath (emptyFile )
316
329
if err != nil {
317
330
t .Fatal (err )
318
331
}
0 commit comments