@@ -30,14 +30,16 @@ func init() {
30
30
}
31
31
32
32
func TestMain (m * testing.M ) {
33
+ var exitCode int
34
+
33
35
// Hack to test with multiple widths, without hassle.
34
36
for defaultBitWidth = 2 ; defaultBitWidth <= 18 ; defaultBitWidth ++ {
35
37
fmt .Printf ("WIDTH %d\n " , defaultBitWidth )
36
38
if code := m .Run (); code != 0 {
37
- os . Exit ( code )
39
+ exitCode = code
38
40
}
39
41
}
40
- os .Exit (0 )
42
+ os .Exit (exitCode )
41
43
}
42
44
43
45
type mockBlocks struct {
@@ -125,7 +127,6 @@ func TestBasicSetGet(t *testing.T) {
125
127
assertGet (ctx , t , clean , 2 , "foo" )
126
128
127
129
assertCount (t , clean , 1 )
128
-
129
130
}
130
131
131
132
func TestRoundTrip (t * testing.T ) {
@@ -328,9 +329,9 @@ func TestChaos(t *testing.T) {
328
329
bs := cbor .NewCborStore (newMockBlocks ())
329
330
seed := time .Now ().UnixNano ()
330
331
ctx := context .Background ()
331
- //seed = 1579200312848358622 // FIXED
332
- //seed = 1579202116615474412
333
- //seed = 1579202774458659521
332
+ // seed = 1579200312848358622 // FIXED
333
+ // seed = 1579202116615474412
334
+ // seed = 1579202774458659521
334
335
// all above are with ops=100,maxIndx=2000
335
336
r := rand .New (rand .NewSource (seed ))
336
337
t .Logf ("seed: %d" , seed )
@@ -526,7 +527,7 @@ func TestDelete(t *testing.T) {
526
527
assertDelete (t , a , 3 )
527
528
528
529
assertCount (t , a , 0 )
529
- fmt . Println ("trying deeper operations now" )
530
+ t . Logf ("trying deeper operations now" )
530
531
531
532
assertSet (t , a , 23 , "dog" )
532
533
assertSet (t , a , 24 , "dog" )
@@ -557,9 +558,9 @@ func TestDelete(t *testing.T) {
557
558
}
558
559
559
560
if c != a2c {
560
- fmt . Printf ("%#v\n " , a )
561
- fmt . Printf ("%#v\n " , na )
562
- fmt . Printf ("%#v\n " , a2 )
561
+ t . Logf ("%#v\n " , a )
562
+ t . Logf ("%#v\n " , na )
563
+ t . Logf ("%#v\n " , a2 )
563
564
t .Fatal ("unexpected cid" , c , a2c )
564
565
}
565
566
}
@@ -833,7 +834,7 @@ func TestFirstSetIndex(t *testing.T) {
833
834
found , err := after .Delete (ctx , v )
834
835
require .NoError (t , err )
835
836
require .True (t , found )
836
- fsi , err = after .FirstSetIndex (ctx )
837
+ _ , err = after .FirstSetIndex (ctx )
837
838
require .Error (t , err )
838
839
}
839
840
}
0 commit comments