@@ -280,6 +280,60 @@ Rebol [
280
280
===end-group===
281
281
282
282
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
+
283
337
===start-group=== "REPLACE string!"
284
338
;@@ https://github.com/Oldes/Rebol-issues/issues/54
285
339
--test-- "issue-54"
@@ -812,6 +866,18 @@ Rebol [
812
866
unset? pick b 2
813
867
unset? b/2
814
868
]
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]
815
881
===end-group===
816
882
817
883
===start-group=== "POKEZ"
@@ -903,6 +969,22 @@ Rebol [
903
969
--assert 3 = length? x
904
970
x: copy [] insert /dup x 5 -1
905
971
--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
+
906
988
907
989
===end-group===
908
990
@@ -1097,6 +1179,20 @@ Rebol [
1097
1179
--assert not past? b
1098
1180
===end-group===
1099
1181
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
+
1100
1196
1101
1197
===start-group=== "SORT"
1102
1198
@@ -1490,6 +1586,15 @@ Rebol [
1490
1586
;--assert txt = iconv #{FFFE50005901690068006C00E100730069007400} 'UTF16
1491
1587
--assert (next txt) = iconv next #{ 50F869686CE1736974 } 28592
1492
1588
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
+
1493
1598
--test-- "ICONV with empty imput"
1494
1599
--assert "" = iconv #{} 28592
1495
1600
--assert "" = iconv #{} 'utf8
@@ -1721,6 +1826,12 @@ Rebol [
1721
1826
--assert "<a<b b>>" = mold append <a > <b b >
1722
1827
--assert "<a<b b>>" = mold join <a > <b b >
1723
1828
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
+
1724
1835
===end-group===
1725
1836
1726
1837
@@ -1797,6 +1908,13 @@ Rebol [
1797
1908
--assert block? random next [1 2 ]
1798
1909
--assert integer? random/only next [1 2 ]
1799
1910
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
+
1800
1918
===end-group===
1801
1919
1802
1920
@@ -1896,6 +2014,19 @@ Rebol [
1896
2014
;@@ https://github.com/Oldes/Rebol-issues/issues/690
1897
2015
--assert (split "This! is a. test? to see " charset "!?." ) = ["This" " is a" " test" " to see " ]
1898
2016
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
+
1899
2030
===end-group===
1900
2031
1901
2032
@@ -2063,6 +2194,8 @@ Rebol [
2063
2194
--assert [#[none] #[none]] = array 2
2064
2195
--test-- "array/initial"
2065
2196
--assert [0 0 ] = array/initial 2 0
2197
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/360
2198
+ --assert [["" "" ] ["" "" ]] = array/initial [2 2 ] ""
2066
2199
--test-- "array/initial func"
2067
2200
;@@ https://github.com/Oldes/Rebol-issues/issues/2193
2068
2201
--assert [10 9 8 7 6 5 4 3 2 1 ] = array/initial length: 10 func [] [-- length]
@@ -2135,6 +2268,13 @@ Rebol [
2135
2268
2136
2269
===end-group===
2137
2270
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
+
2138
2278
;-- VECTOR related tests moved to %vector-test.r3
2139
2279
2140
- ~~~end-file~~~
2280
+ ~~~end-file~~~
0 commit comments