@@ -73,8 +73,8 @@ func TestIssueAndReceive(t *testing.T) {
7373 }
7474 chbook .sent [addr1 ] = new (big.Int ).SetUint64 (42 )
7575 amount := common .Big1
76- ch , err := chbook . Issue ( addr1 , amount )
77- if err == nil {
76+
77+ if _ , err = chbook . Issue ( addr1 , amount ); err == nil {
7878 t .Fatalf ("expected insufficient funds error, got none" )
7979 }
8080
@@ -83,7 +83,7 @@ func TestIssueAndReceive(t *testing.T) {
8383 t .Fatalf ("expected: %v, got %v" , "0" , chbook .Balance ())
8484 }
8585
86- ch , err = chbook .Issue (addr1 , amount )
86+ ch , err : = chbook .Issue (addr1 , amount )
8787 if err != nil {
8888 t .Fatalf ("expected no error, got %v" , err )
8989 }
@@ -128,8 +128,8 @@ func TestCheckbookFile(t *testing.T) {
128128 t .Errorf ("expected: %v, got %v" , "0" , chbook .Balance ())
129129 }
130130
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 {
133133 t .Fatalf ("expected no error, got %v" , err )
134134 }
135135 if ch .Amount .Cmp (new (big.Int ).SetUint64 (43 )) != 0 {
@@ -155,7 +155,7 @@ func TestVerifyErrors(t *testing.T) {
155155 }
156156
157157 path1 := filepath .Join (os .TempDir (), "chequebook-test-1.json" )
158- contr1 , err := deploy (key1 , common .Big2 , backend )
158+ contr1 , _ := deploy (key1 , common .Big2 , backend )
159159 chbook1 , err := NewChequebook (path1 , contr1 , key1 , backend )
160160 if err != nil {
161161 t .Errorf ("expected no error, got %v" , err )
@@ -223,7 +223,8 @@ func TestVerifyErrors(t *testing.T) {
223223func TestDeposit (t * testing.T ) {
224224 path0 := filepath .Join (os .TempDir (), "chequebook-test-0.json" )
225225 backend := newTestBackend ()
226- contr0 , err := deploy (key0 , new (big.Int ), backend )
226+ contr0 , _ := deploy (key0 , new (big.Int ), backend )
227+
227228 chbook , err := NewChequebook (path0 , contr0 , key0 , backend )
228229 if err != nil {
229230 t .Errorf ("expected no error, got %v" , err )
@@ -361,7 +362,8 @@ func TestDeposit(t *testing.T) {
361362func TestCash (t * testing.T ) {
362363 path := filepath .Join (os .TempDir (), "chequebook-test.json" )
363364 backend := newTestBackend ()
364- contr0 , err := deploy (key0 , common .Big2 , backend )
365+ contr0 , _ := deploy (key0 , common .Big2 , backend )
366+
365367 chbook , err := NewChequebook (path , contr0 , key0 , backend )
366368 if err != nil {
367369 t .Errorf ("expected no error, got %v" , err )
@@ -380,11 +382,12 @@ func TestCash(t *testing.T) {
380382 }
381383
382384 // cashing latest cheque
383- _ , err = chbox .Receive (ch )
384- if err != nil {
385+ if _ , err = chbox .Receive (ch ); err != nil {
385386 t .Fatalf ("expected no error, got %v" , err )
386387 }
387- _ , err = ch .Cash (chbook .session )
388+ if _ , err = ch .Cash (chbook .session ); err != nil {
389+ t .Fatal ("Cash failed:" , err )
390+ }
388391 backend .Commit ()
389392
390393 chbook .balance = new (big.Int ).Set (common .Big3 )
0 commit comments