mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: test invalid abi
This commit is contained in:
parent
d6fcb0fc77
commit
67a9c805f6
1 changed files with 13 additions and 0 deletions
|
|
@ -200,6 +200,19 @@ func TestReader(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInvalidABI(t *testing.T) {
|
||||||
|
json := `[{ "type" : "function", "name" : "", "constant" : fals }]`
|
||||||
|
_, err := JSON(strings.NewReader(json))
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("invalid json should produce error")
|
||||||
|
}
|
||||||
|
json2 := `[{ "type" : "function", "name" : "send", "constant" : false, "inputs" : [ { "name" : "amount", "typ" : "uint256" } ] }]`
|
||||||
|
_, err = JSON(strings.NewReader(json2))
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("invalid json should produce error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestConstructor tests a constructor function.
|
// TestConstructor tests a constructor function.
|
||||||
// The test is based on the following contract:
|
// The test is based on the following contract:
|
||||||
// contract TestConstructor {
|
// contract TestConstructor {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue