diff --git a/src/boot/actions.r b/src/boot/actions.r index 3317537cfd..69038c1d2e 100644 --- a/src/boot/actions.r +++ b/src/boot/actions.r @@ -140,7 +140,7 @@ head?: action [ tail?: action [ {Returns TRUE if series is at or past its end; or empty for other types.} - series [series! gob! port! bitset! map!] + series [series! gob! port! bitset! typeset! map!] ] past?: action [ diff --git a/src/core/t-typeset.c b/src/core/t-typeset.c index 46583565cb..52fe7ba9a5 100644 --- a/src/core/t-typeset.c +++ b/src/core/t-typeset.c @@ -254,6 +254,10 @@ VAL_TYPESET(val) = ~VAL_TYPESET(val); return R_ARG1; + case A_TAILQ: + // Necessary to make EMPTY? work: + return (VAL_TYPESET(val) == 0) ? R_TRUE : R_FALSE; + default: Trap_Action(REB_TYPESET, action); } diff --git a/src/mezz/mezz-series.r b/src/mezz/mezz-series.r index d9f183ba23..aa6e7fb47a 100644 --- a/src/mezz/mezz-series.r +++ b/src/mezz/mezz-series.r @@ -14,7 +14,7 @@ REBOL [ empty?: make :tail? [ [ {Returns TRUE if empty or NONE, or for series if index is at or beyond its tail.} - series [series! object! gob! port! bitset! map! none!] + series [series! object! gob! port! bitset! typeset! map! none!] ] ] diff --git a/src/tests/run-tests.r3 b/src/tests/run-tests.r3 index 8dbb1e08af..999ddaf3de 100644 --- a/src/tests/run-tests.r3 +++ b/src/tests/run-tests.r3 @@ -40,6 +40,7 @@ dt [ ;- delta time wrap load %units/image-test.r3 wrap load %units/file-test.r3 wrap load %units/func-test.r3 + wrap load %units/typeset-test.r3 recycle/torture recycle diff --git a/src/tests/units/typeset-test.r3 b/src/tests/units/typeset-test.r3 new file mode 100644 index 0000000000..e5713362e1 --- /dev/null +++ b/src/tests/units/typeset-test.r3 @@ -0,0 +1,42 @@ +Rebol [ + Title: "Rebol3 typeset! test script" + Author: "Oldes, Peter W A Wood" + File: %typeset-test.r3 + Tabs: 4 + Needs: [%../quick-test-module.r3] +] + +~~~start-file~~~ "typeset" + +===start-group=== "typeset!" + --test-- "make typeset!" + --assert typeset? types: make typeset! [block! map! object!] + --test-- "find in typeset" + --assert find types block! + --assert find types map! + --assert find types object! + --assert not find types string! + + --test-- "union of typesets" + types2: union types make typeset! [string!] + --assert typeset? types2 + --assert find types2 string! + + --test-- "complement of typesets" + not-types: complement types + --assert typeset? not-types + --assert find not-types integer! + + --test-- "difference of typesets" + types3: difference types make typeset! [object!] + --assert typeset? types3 + --assert not find types3 object! + + --test-- "empty typeset test" + ;@@ requested: https://github.com/red/REP/issues/55 + --assert empty? make typeset! [] + --assert not empty? types + +===end-group=== + +~~~end-file~~~ \ No newline at end of file