Skip to content

Commit

Permalink
FIX: report full failed expression when assert fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Dec 9, 2020
1 parent b4c6da2 commit cedd821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/n-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int Check_Char_Range(REBVAL *val, REBINT limit)
index = Do_Next(block, i = index, 0); // stack volatile
ds = DS_POP; // volatile stack reference
if (IS_FALSE(ds)) {
Set_Block(ds, Copy_Block_Len(block, i, 3));
Set_Block(ds, Copy_Block(VAL_SERIES(value), VAL_INDEX(value))); // #2231
Trap1(RE_ASSERT_FAILED, ds);
}
if (THROWN(ds)) return R_TOS1;
Expand Down
8 changes: 8 additions & 0 deletions src/tests/units/error-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ Rebol [
e/id = 'assert-failed
e/arg1 = [not none? none]
]

--test-- "assert with longer expression"
;@@ https://github.com/Oldes/Rebol-issues/issues/2231
--assert all [
error? e: try [assert [true 1 + 3 = 2 true]]
e/id = 'assert-failed
e/arg1 = [true 1 + 3 = 2 true]
]

--test-- "valid assert/type"
x: 1
Expand Down

0 comments on commit cedd821

Please sign in to comment.