Commit 28842272308202904cd517cd6ec8fbaad554e0f6
added copy method to funcRef
Signed-off-by: wanderer <mjbecze@gmail.com>wanderer committed on 4/2/2018, 6:52:20 PM
Parent: afef714fae2f6cadcc283ac4635d1c542ff5a971
Files changed
index.js | changed |
tests/index.js | changed |
index.js | ||
---|---|---|
@@ -83,8 +83,17 @@ | ||
83 | 83 … | this.actorID, |
84 | 84 … | this.gas |
85 | 85 … | ])) |
86 | 86 … | } |
87 … | + | |
88 … | + copy () { | |
89 … | + return new FunctionRef({ | |
90 … | + identifier: this.identifier, | |
91 … | + actorID: this.actorID, | |
92 … | + params: this.params, | |
93 … | + gas: this.gas | |
94 … | + }) | |
95 … | + } | |
87 | 96 … | } |
88 | 97 … | |
89 | 98 … | /** |
90 | 99 … | * A module reference |
tests/index.js | ||
---|---|---|
@@ -21,8 +21,12 @@ | ||
21 | 21 … | const rmodRef = objects.decoder.decodeFirst(enmod) |
22 | 22 … | t.deepEquals(modRef, rmodRef) |
23 | 23 … | |
24 | 24 … | const funcRef = rmodRef.getFuncRef('name') |
25 … | + funcRef.gas = 1000 | |
26 … | + const funcRef2 = funcRef.copy() | |
27 … | + funcRef2.gas = 500 | |
28 … | + t.equals(funcRef.gas, 1000, 'should have correct gas amount') | |
25 | 29 … | const enFuncRef = cbor.encode(funcRef) |
26 | 30 … | const rFuncRef = objects.decoder.decodeFirst(enFuncRef) |
27 | 31 … | t.deepEquals(funcRef, rFuncRef) |
28 | 32 … |
Built with git-ssb-web