aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/natspec/natspec_test.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-03-16 23:46:29 +0800
committerzelig <viktor.tron@gmail.com>2015-03-16 23:46:29 +0800
commit5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb (patch)
treed5ba6197a8c0c8e36bb92ee9fc8aad717cb2d178 /ethutil/natspec/natspec_test.go
parent8393dab470c40678caf36ada82e312d29c4cf5c4 (diff)
parent22893b7ac925c49168c119f293ea8befc3aff5cc (diff)
downloaddexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.gz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.bz2
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.lz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.xz
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.tar.zst
dexon-5e7702fd050ed5520a03cc2cfc8b1f45a70f35fb.zip
Merge remote-tracking branch 'upstream/develop' into frontier/js
Conflicts: cmd/ethereum/js.go javascript/types.go
Diffstat (limited to 'ethutil/natspec/natspec_test.go')
-rw-r--r--ethutil/natspec/natspec_test.go97
1 files changed, 0 insertions, 97 deletions
diff --git a/ethutil/natspec/natspec_test.go b/ethutil/natspec/natspec_test.go
deleted file mode 100644
index 330dc831d..000000000
--- a/ethutil/natspec/natspec_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package natspec
-
-import (
- "testing"
-)
-
-func TestNotice(t *testing.T) {
-
- tx := `
- {
- "jsonrpc": "2.0",
- "method": "eth_call",
- "params": [{
- "to": "0x8521742d3f456bd237e312d6e30724960f72517a",
- "data": "0xc6888fa1000000000000000000000000000000000000000000000000000000000000007a"
- }],
- "id": 6
- }
- `
-
- abi := `
- [{
- "name": "multiply",
- "constant": false,
- "type": "function",
- "inputs": [{
- "name": "a",
- "type": "uint256"
- }],
- "outputs": [{
- "name": "d",
- "type": "uint256"
- }]
- }]
- `
-
- desc := "Will multiply `a` by 7 and return `a * 7`."
-
- method := "multiply"
-
- ns, err := New()
- if err != nil {
- t.Errorf("NewNATSpec error %v", err)
- }
-
- notice, err := ns.Notice(tx, abi, method, desc)
-
- if err != nil {
- t.Errorf("expected no error got %v", err)
- }
-
- expected := "Will multiply 122 by 7 and return 854."
- if notice != expected {
- t.Errorf("incorrect notice. expected %v, got %v", expected, notice)
- } else {
- t.Logf("returned notice \"%v\"", notice)
- }
-
- notice, err = ns.Notice(tx, abi, method, "Will multiply 122 by \"7\" and return 854.")
-
- expected = "natspec.js error setting expression: (anonymous): Line 1:41 Unexpected number"
-
- if err == nil {
- t.Errorf("expected error, got nothing (notice: '%v')", err, notice)
- } else {
- if err.Error() != expected {
- t.Errorf("expected error '%s' got '%v' (notice: '%v')", expected, err, notice)
- }
- }
-
- // https://github.com/ethereum/natspec.js/issues/1
- badDesc := "Will multiply `e` by 7 and return `a * 7`."
- notice, err = ns.Notice(tx, abi, method, badDesc)
-
- expected = "natspec.js error evaluating expression: Error: Natspec evaluation failed, wrong input params"
-
- if err == nil {
- t.Errorf("expected error, got nothing (notice: '%v')", notice)
- } else {
- if err.Error() != expected {
- t.Errorf("expected error '%s' got '%v' (notice: '%v')", expected, err, notice)
- }
- }
-
- notice, err = ns.Notice(tx, abi, "missing_method", desc)
-
- expected = "natspec.js error evaluating expression: Error: Natspec evaluation failed, method does not exist"
-
- if err == nil {
- t.Errorf("expected error, got nothing (notice: '%v')", notice)
- } else {
- if err.Error() != expected {
- t.Errorf("expected error '%s' got '%v' (notice: '%v')", expected, err, notice)
- }
- }
-
-}