forked from rebolsource/r3
-
-
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.
FEAT: making UNSET! as a conditionally "TRUTHY"
related issues: metaeducation/rebol-issues#564 metaeducation/rebol-issues#850 It reverts changes discussed in above issues as I consider this behavior to be more useful and it is compatible with Rebol2 and Red. My main reason is to be able use PRINT inside ALL blocks without need to worry if these would affect the evaluation. Like in this case: ``` if all [ not headers any [ all [ d1: find conn/data crlfbin d2: find/tail d1 crlf2bin print "server using standard content separator of #{0D0A0D0A}" ] all [ d1: find conn/data #{0A} d2: find/tail d1 #{0A0A} print "server using malformed line separator of #{0A0A}" ] ] ][ ... ] ```
- Loading branch information
Showing
5 changed files
with
39 additions
and
6 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
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
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
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
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,32 @@ | ||
Rebol [ | ||
Title: "Rebol conditional test script" | ||
Author: "Olds" | ||
File: %conditional-test.r3 | ||
Tabs: 4 | ||
Needs: [%../quick-test-module.r3] | ||
] | ||
|
||
~~~start-file~~~ "Conditional" | ||
|
||
===start-group=== "Dealing with unset! value in conditions" | ||
--test-- "any" | ||
--assert unset? any [() 2] | ||
--assert true? any [() 2] | ||
--test-- "all" | ||
--assert true? all [] | ||
--assert true? all [()] | ||
--assert 3 = all [() 1 2 3] | ||
--assert unset? all [1 ()] | ||
--assert 1 = if all [1 ()][1] | ||
--assert 1 = either all [()][1][2] | ||
--test-- "any and all" | ||
if any [ | ||
all [false x: 1 ()] | ||
all [true x: 2 ()] | ||
][ x: 2 * x] | ||
--assert x = 4 | ||
|
||
|
||
===end-group=== | ||
|
||
~~~end-file~~~ |