-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct object evaluation order, closes #260
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
pact-tests/pact-tests/object-evaluation-order-regression.repl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
;; Regression for https://github.com/kadena-io/pact-5/issues/260 | ||
|
||
(module my-mod G | ||
@doc "A simple module that manages a counter" | ||
(defcap G() true) | ||
|
||
(defschema counter-schema | ||
cnt:integer) | ||
|
||
(deftable counter-table:{counter-schema}) | ||
|
||
(defun init:string () | ||
@doc "Initialize the counter" | ||
(insert counter-table "SINGLETON" {'cnt:0}) | ||
) | ||
|
||
(defun increment:integer () | ||
@doc "Increment the counter and return the old value" | ||
(with-read counter-table "SINGLETON" {'cnt:=old-value} | ||
(update counter-table "SINGLETON" {'cnt:(+ 1 old-value)}) | ||
old-value) | ||
) | ||
|
||
) | ||
; Init the counter | ||
(create-table counter-table) | ||
(my-mod.init) | ||
|
||
(expect "check evaluation order from left to right" {'a:(my-mod.increment), 'b:(my-mod.increment), 'c:(my-mod.increment)} {'a: 0, 'b:1, 'c:2}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters