Skip to content

Commit 4ac29ab

Browse files
committed
TEST: returned tests removed by accident in commit b751885
1 parent b751885 commit 4ac29ab

File tree

1 file changed

+141
-1
lines changed

1 file changed

+141
-1
lines changed

src/tests/units/series-test.r3

+141-1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,60 @@ Rebol [
280280
===end-group===
281281

282282

283+
===start-group=== "TRIM"
284+
--test-- "trim string!"
285+
str1: " a b c "
286+
str2: " ^(A0) ^-a b ^- c ^(2000) "
287+
mstr: { a ^-1^/ ab2^- ^/ ac3 ^/ ^/^/}
288+
--assert "a b c" = trim copy str1
289+
--assert "a b c" = trim/head/tail copy str1
290+
--assert "a b c " = trim/head copy str1
291+
--assert " a b c" = trim/tail copy str1
292+
; --assert "a b ^- c" = trim copy str2 ;- not like Red!
293+
--assert "a ^-1^/ab2^/ac3^/" = trim copy mstr
294+
--assert "a1ab2ac3" = trim/all { a ^-1^/ ab2^- ^/ ac3 ^/ ^/^/}
295+
--assert " ^-1^/ b2^- ^/ c3 ^/ ^/^/" = trim/with copy mstr #"a"
296+
--assert " ^-1^/ b2^- ^/ c3 ^/ ^/^/" = trim/with copy mstr 97
297+
--test-- "trim binary!"
298+
;@@ https://github.com/Oldes/Rebol-issues/issues/1482
299+
bin: #{0011001100}
300+
--assert #{110011} = trim copy bin
301+
--assert #{110011} = trim/head/tail copy bin
302+
--assert #{11001100} = trim/head copy bin
303+
--assert #{00110011} = trim/tail copy bin
304+
--assert #{1111} = trim/all copy bin
305+
--assert #{000000} = trim/all/with copy bin #{11}
306+
--assert #{} = trim #{0000}
307+
--assert #{} = trim/tail #{0000}
308+
--assert #{} = trim/head #{0000}
309+
--assert #{2061626320} = trim/head/tail to-binary " abc "
310+
--test-- "trim binary! incompatible"
311+
--assert all [error? e: try [trim/auto #{00}] e/id = 'bad-refines]
312+
--assert all [error? e: try [trim/lines #{00}] e/id = 'bad-refines]
313+
--assert all [error? e: try [trim/head/all #{00}] e/id = 'bad-refines]
314+
--assert all [error? e: try [trim/tail/all #{00}] e/id = 'bad-refines]
315+
--assert all [error? e: try [trim/tail/with #{00} 0] e/id = 'bad-refines]
316+
--assert all [error? e: try [trim/head/with #{00} 0] e/id = 'bad-refines]
317+
--test-- "trim binary! with index > 1"
318+
bin: #{0000110000}
319+
--assert #{00001100} = head trim/tail at copy bin 5
320+
--assert #{00110000} = head trim/head at copy bin 2
321+
--assert #{0011} = head trim/all at copy bin 2
322+
--test-- "trim block!"
323+
blk: [#[none] 1 #[none] 2 #[none]]
324+
;@@ https://github.com/Oldes/Rebol-issues/issues/825
325+
--assert [1 #[none] 2 #[none]] = trim/head copy blk
326+
--assert [#[none] 1 #[none] 2] = trim/tail copy blk
327+
;@@ https://github.com/Oldes/Rebol-issues/issues/2482
328+
--assert [1 #[none] 2] = trim copy blk
329+
--assert [1 2] = trim/all copy blk
330+
--assert all [error? e: try [trim/head/all []] e/id = 'bad-refines]
331+
--assert all [error? e: try [trim/tail/all []] e/id = 'bad-refines]
332+
333+
===end-group===
334+
335+
336+
283337
===start-group=== "REPLACE string!"
284338
;@@ https://github.com/Oldes/Rebol-issues/issues/54
285339
--test-- "issue-54"
@@ -812,6 +866,18 @@ Rebol [
812866
unset? pick b 2
813867
unset? b/2
814868
]
869+
--test-- "out of range"
870+
;@@ https://github.com/Oldes/Rebol-issues/issues/1057
871+
a: #{0102}
872+
--assert 3 = poke a 1 3
873+
--assert a = #{0302}
874+
--assert all [error? e: try [poke a 1 300] e/id = 'out-of-range]
875+
--assert 4 = a/1: 4
876+
--assert a = #{0402}
877+
--assert all [error? e: try [a/1: 400] e/id = 'out-of-range]
878+
--assert #{02} = change a 5
879+
--assert a = #{0502}
880+
--assert all [error? e: try [change a 500] e/id = 'out-of-range]
815881
===end-group===
816882

817883
===start-group=== "POKEZ"
@@ -903,6 +969,22 @@ Rebol [
903969
--assert 3 = length? x
904970
x: copy [] insert/dup x 5 -1
905971
--assert 0 = length? x
972+
--test-- "insert/part"
973+
;@@ https://github.com/Oldes/Rebol-issues/issues/856
974+
a: make block! 10
975+
b: at [1 2 3 4 5 6 7 8 9] 5
976+
--assert tail? insert/part a b 2
977+
--assert a = [5 6]
978+
insert/part clear a b 2147483647
979+
--assert a = [5 6 7 8 9]
980+
insert/part clear a b -2
981+
--assert a = [3 4]
982+
insert/part clear a b -2147483647
983+
--assert a = [1 2 3 4]
984+
--assert all [error? e: try [insert/part clear a b 2147483648] e/id = 'out-of-range]
985+
--assert all [error? e: try [insert/part clear a b -2147483649] e/id = 'out-of-range]
986+
987+
906988

907989
===end-group===
908990

@@ -1097,6 +1179,20 @@ Rebol [
10971179
--assert not past? b
10981180
===end-group===
10991181

1182+
===start-group=== "SNGLE?"
1183+
--test-- "single? block"
1184+
;@@ https://github.com/Oldes/Rebol-issues/issues/875
1185+
--assert single? [a]
1186+
--assert single? next [a b]
1187+
--assert not single? [a b]
1188+
--assert not single? []
1189+
--test-- "single? string!"
1190+
--assert single? "a"
1191+
--assert single? next "ab"
1192+
--assert not single? "ab"
1193+
--assert not single? ""
1194+
===end-group===
1195+
11001196

11011197
===start-group=== "SORT"
11021198

@@ -1490,6 +1586,15 @@ Rebol [
14901586
;--assert txt = iconv #{FFFE50005901690068006C00E100730069007400} 'UTF16
14911587
--assert (next txt) = iconv next #{50F869686CE1736974} 28592
14921588

1589+
--test-- "ICONV from UTF-8"
1590+
;@@ https://github.com/Oldes/Rebol-issues/issues/2475
1591+
--assert "š" = iconv #{C5A1} 'utf8
1592+
--assert "š" = iconv #{C5A1} 'utf-8
1593+
--assert "š" = iconv #{C5A1} 'UTF8
1594+
--assert "š" = iconv #{C5A1} 'UTF-8
1595+
--assert "š" = iconv #{C5A1} 'CP65001
1596+
--assert "š" = iconv #{C5A1} 65001
1597+
14931598
--test-- "ICONV with empty imput"
14941599
--assert "" = iconv #{} 28592
14951600
--assert "" = iconv #{} 'utf8
@@ -1721,6 +1826,12 @@ Rebol [
17211826
--assert "<a<b b>>" = mold append <a> <b b>
17221827
--assert "<a<b b>>" = mold join <a> <b b>
17231828

1829+
--test-- "CRLF inside tag"
1830+
;@@ https://github.com/Oldes/Rebol-issues/issues/1233
1831+
; CRLF is not automatically converted inside tags
1832+
--assert #{410D0A} = to-binary first transcode #{3C410D0A3E}
1833+
--assert #{410A} = to-binary deline first transcode #{3C410D0A3E}
1834+
17241835
===end-group===
17251836

17261837

@@ -1797,6 +1908,13 @@ Rebol [
17971908
--assert block? random next [1 2]
17981909
--assert integer? random/only next [1 2]
17991910

1911+
--test-- "copy/part limit"
1912+
;@@ https://github.com/Oldes/Rebol-issues/issues/853
1913+
--assert [1] = copy/part tail [1] -2147483647
1914+
--assert [1] = copy/part tail [1] -2147483648
1915+
--assert all [error? e: try [copy/part tail [1] -2147483649] e/id = 'out-of-range]
1916+
1917+
18001918
===end-group===
18011919

18021920

@@ -1896,6 +2014,19 @@ Rebol [
18962014
;@@ https://github.com/Oldes/Rebol-issues/issues/690
18972015
--assert (split "This! is a. test? to see " charset "!?.") = ["This" " is a" " test" " to see "]
18982016

2017+
--test-- "split/at"
2018+
;@@ https://github.com/Oldes/Rebol-issues/issues/2490
2019+
--assert (split/at "a:b" #":") = ["a" "b"]
2020+
--assert (split/at "a:b:c" #":") = ["a" "b:c"]
2021+
--assert (split/at "a" #":") = ["a"]
2022+
--assert (split/at "a:" #":") = ["a" ""]
2023+
--assert (split/at ":b" #":") = ["" "b"]
2024+
--assert (split/at [1 a 2] 'a) = [[1] [2]]
2025+
--assert (split/at [1 a 2 3] 'a) = [[1] [2 3]]
2026+
--assert (split/at [1 a 2 a 3] 'a) = [[1] [2 a 3]]
2027+
--assert (split/at [1 2] 'a) = [[1 2]]
2028+
2029+
18992030
===end-group===
19002031

19012032

@@ -2063,6 +2194,8 @@ Rebol [
20632194
--assert [#[none] #[none]] = array 2
20642195
--test-- "array/initial"
20652196
--assert [0 0] = array/initial 2 0
2197+
;@@ https://github.com/Oldes/Rebol-issues/issues/360
2198+
--assert [["" ""] ["" ""]] = array/initial [2 2] ""
20662199
--test-- "array/initial func"
20672200
;@@ https://github.com/Oldes/Rebol-issues/issues/2193
20682201
--assert [10 9 8 7 6 5 4 3 2 1] = array/initial length: 10 func [] [-- length]
@@ -2135,6 +2268,13 @@ Rebol [
21352268

21362269
===end-group===
21372270

2271+
===start-group=== "MOVE"
2272+
--test-- "move/skip"
2273+
;@@ https://github.com/Oldes/Rebol-issues/issues/740
2274+
--assert all [error? e: try [move/skip [1 2 3] 2 0] e/id = 'out-of-range]
2275+
2276+
===end-group===
2277+
21382278
;-- VECTOR related tests moved to %vector-test.r3
21392279

2140-
~~~end-file~~~
2280+
~~~end-file~~~

0 commit comments

Comments
 (0)