Skip to content

Commit

Permalink
20221020 clvm rs exceptions (#127)
Browse files Browse the repository at this point in the history
* Adapt raise tests to reflect the requested raise changes that were made in clvm_rs and now here.  Throwing a single atom as one argument causes that argument to be thrown individually.  Some people who write chialisp use ad-hoc tools and this is easier to parse.

* Adapt raise tests to reflect the requested raise changes that were made in clvm_rs and now here.  Throwing a single atom as one argument causes that argument to be thrown individually.  Some people who write chialisp use ad-hoc tools and this is easier to parse.

* Use the default backend in these tests so the whole suite can vary between python and rust
  • Loading branch information
prozacchiwawa committed Oct 21, 2022
1 parent 1a794c4 commit 480b328
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion clvm/core_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def op_listp(args: SExp):


def op_raise(args: SExp):
raise EvalError("clvm raise", args)
if args.list_len() == 1 and not args.first().listp():
raise EvalError("clvm raise", args.first())
else:
raise EvalError("clvm raise", args)


def op_eq(args: SExp):
Expand Down
2 changes: 1 addition & 1 deletion tests/brun/raise-1.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
brun -c '(x (q . 2000))'
FAIL: clvm raise (2000)
FAIL: clvm raise 2000
2 changes: 1 addition & 1 deletion tests/brun/raise-2.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
brun -c '(x (q . 2000))'
FAIL: clvm raise (2000)
FAIL: clvm raise 2000
2 changes: 2 additions & 0 deletions tests/brun/raise-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brun '(x (q 99 101))'
FAIL: clvm raise ((99 101))
2 changes: 2 additions & 0 deletions tests/brun/raise-many-args.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brun '(x (q . 99) (q . 101))'
FAIL: clvm raise (99 101)
2 changes: 2 additions & 0 deletions tests/brun/raise-single-atom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brun '(x (q . 99))'
FAIL: clvm raise 99
2 changes: 1 addition & 1 deletion tests/edge-cases/raise-02.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
brun -n '(x (q . 1))'
FAIL: clvm raise (1)
FAIL: clvm raise 1

0 comments on commit 480b328

Please sign in to comment.