@@ -73,8 +73,8 @@ func TestIssueAndReceive(t *testing.T) {
73
73
}
74
74
chbook .sent [addr1 ] = new (big.Int ).SetUint64 (42 )
75
75
amount := common .Big1
76
- ch , err := chbook . Issue ( addr1 , amount )
77
- if err == nil {
76
+
77
+ if _ , err = chbook . Issue ( addr1 , amount ); err == nil {
78
78
t .Fatalf ("expected insufficient funds error, got none" )
79
79
}
80
80
@@ -83,7 +83,7 @@ func TestIssueAndReceive(t *testing.T) {
83
83
t .Fatalf ("expected: %v, got %v" , "0" , chbook .Balance ())
84
84
}
85
85
86
- ch , err = chbook .Issue (addr1 , amount )
86
+ ch , err : = chbook .Issue (addr1 , amount )
87
87
if err != nil {
88
88
t .Fatalf ("expected no error, got %v" , err )
89
89
}
@@ -128,8 +128,8 @@ func TestCheckbookFile(t *testing.T) {
128
128
t .Errorf ("expected: %v, got %v" , "0" , chbook .Balance ())
129
129
}
130
130
131
- ch , err := chbook . Issue ( addr1 , common . Big1 )
132
- if err != nil {
131
+ var ch * Cheque
132
+ if ch , err = chbook . Issue ( addr1 , common . Big1 ); err != nil {
133
133
t .Fatalf ("expected no error, got %v" , err )
134
134
}
135
135
if ch .Amount .Cmp (new (big.Int ).SetUint64 (43 )) != 0 {
@@ -155,7 +155,7 @@ func TestVerifyErrors(t *testing.T) {
155
155
}
156
156
157
157
path1 := filepath .Join (os .TempDir (), "chequebook-test-1.json" )
158
- contr1 , err := deploy (key1 , common .Big2 , backend )
158
+ contr1 , _ := deploy (key1 , common .Big2 , backend )
159
159
chbook1 , err := NewChequebook (path1 , contr1 , key1 , backend )
160
160
if err != nil {
161
161
t .Errorf ("expected no error, got %v" , err )
@@ -223,7 +223,8 @@ func TestVerifyErrors(t *testing.T) {
223
223
func TestDeposit (t * testing.T ) {
224
224
path0 := filepath .Join (os .TempDir (), "chequebook-test-0.json" )
225
225
backend := newTestBackend ()
226
- contr0 , err := deploy (key0 , new (big.Int ), backend )
226
+ contr0 , _ := deploy (key0 , new (big.Int ), backend )
227
+
227
228
chbook , err := NewChequebook (path0 , contr0 , key0 , backend )
228
229
if err != nil {
229
230
t .Errorf ("expected no error, got %v" , err )
@@ -361,7 +362,8 @@ func TestDeposit(t *testing.T) {
361
362
func TestCash (t * testing.T ) {
362
363
path := filepath .Join (os .TempDir (), "chequebook-test.json" )
363
364
backend := newTestBackend ()
364
- contr0 , err := deploy (key0 , common .Big2 , backend )
365
+ contr0 , _ := deploy (key0 , common .Big2 , backend )
366
+
365
367
chbook , err := NewChequebook (path , contr0 , key0 , backend )
366
368
if err != nil {
367
369
t .Errorf ("expected no error, got %v" , err )
@@ -380,11 +382,12 @@ func TestCash(t *testing.T) {
380
382
}
381
383
382
384
// cashing latest cheque
383
- _ , err = chbox .Receive (ch )
384
- if err != nil {
385
+ if _ , err = chbox .Receive (ch ); err != nil {
385
386
t .Fatalf ("expected no error, got %v" , err )
386
387
}
387
- _ , err = ch .Cash (chbook .session )
388
+ if _ , err = ch .Cash (chbook .session ); err != nil {
389
+ t .Fatal ("Cash failed:" , err )
390
+ }
388
391
backend .Commit ()
389
392
390
393
chbook .balance = new (big.Int ).Set (common .Big3 )
0 commit comments