git ssb

0+

wanderer🌟 / js-primea-objects



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.jschanged
tests/index.jschanged
index.jsView
@@ -83,8 +83,17 @@
8383 this.actorID,
8484 this.gas
8585 ]))
8686 }
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 + }
8796 }
8897
8998 /**
9099 * A module reference
tests/index.jsView
@@ -21,8 +21,12 @@
2121 const rmodRef = objects.decoder.decodeFirst(enmod)
2222 t.deepEquals(modRef, rmodRef)
2323
2424 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')
2529 const enFuncRef = cbor.encode(funcRef)
2630 const rFuncRef = objects.decoder.decodeFirst(enFuncRef)
2731 t.deepEquals(funcRef, rFuncRef)
2832

Built with git-ssb-web