2017-02-16 18:36:49 -08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2017-02-23 09:30:57 -08:00
|
|
|
func TestNilAccount(t *testing.T) {
|
2017-02-16 18:36:49 -08:00
|
|
|
|
2017-02-23 17:50:20 -08:00
|
|
|
var acc Account
|
2017-02-16 18:36:49 -08:00
|
|
|
|
|
|
|
//test Copy
|
|
|
|
accCopy := acc.Copy()
|
2017-03-23 17:51:50 -07:00
|
|
|
//note that the assert.True is used instead of assert.Equal because looking at pointers
|
2017-04-17 16:53:06 -07:00
|
|
|
assert.True(t, &acc != accCopy, "Account Copy Error, acc1: %v, acc2: %v", &acc, accCopy)
|
2017-03-23 17:51:50 -07:00
|
|
|
assert.Equal(t, acc.Sequence, accCopy.Sequence)
|
2017-02-16 18:36:49 -08:00
|
|
|
|
|
|
|
//test sending nils for panic
|
|
|
|
var nilAcc *Account
|
|
|
|
nilAcc.String()
|
|
|
|
nilAcc.Copy()
|
|
|
|
}
|