File tree 2 files changed +102
-0
lines changed
2 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 265
265
case REB_EMAIL :
266
266
case REB_URL :
267
267
case REB_TAG :
268
+ case REB_REF :
268
269
return Compare_String_Vals (s , t , (REBOOL )!is_case );
269
270
270
271
case REB_BITSET :
Original file line number Diff line number Diff line change @@ -25,8 +25,109 @@ Rebol [
25
25
all [true x: 2 ()]
26
26
][ x: 2 * x]
27
27
--assert x = 4
28
+ ===end-group===
29
+
30
+ ===start-group=== "SWITCH"
31
+ --test-- "switch ref!"
32
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2466
33
+ --assert 1 = switch @a [@a [1 ] @b [2 ]]
34
+ --assert 2 = switch @b [@a [1 ] @b [2 ]]
35
+ ===end-group===
36
+
37
+ ===start-group=== "switch basics local" ;; one "direct" type & one "indirect"
38
+ ;; should be sufficient
39
+
40
+ sb-i: "Hello"
41
+ sb-j: "World"
42
+ switch-fun : func [ /local sb-i sb-j] [
43
+ --test-- "switch-basic-local-1"
44
+ sb-i: 1
45
+ sb-j: -1
46
+ switch sb-i [
47
+ 0 [sb-j: 0 ]
48
+ 1 [sb-j: 1 ]
49
+ 2 [sb-j: 2 ]
50
+ ]
51
+ --assert sb-j = 1
52
+ --test-- "switch-basic-local-2"
53
+ sb-i: "Nenad"
54
+ sb-j: "REBOL"
55
+ switch sb-i [
56
+ "Andreas" [sb-j: "Earl" ]
57
+ "Nenad" [sb-j: "Red" ]
58
+ "Peter" [sb-j: "Peter" ]
59
+ ]
60
+ --assert sb-j = "Red"
61
+ ]
62
+ switch-fun
63
+ --test-- "switch-basic-local-global-1"
64
+ --assert sb-i = "Hello"
65
+ --assert sb-j = "World"
66
+
67
+ ===end-group===
68
+
69
+ ===start-group=== "switch-default"
70
+
71
+ --test-- "switch-default-1"
72
+ sd1-i: 2
73
+ sd1-j: -1
74
+ switch /default sd1-i [
75
+ 1 [sd1-j: 1 ]
76
+ 2 [sd1-j: 2 ]
77
+ ][
78
+ sd1-j: 0
79
+ ]
80
+ --assert sd1-j = 2
81
+
82
+ --test-- "switch-default-2"
83
+ sd2-i: 999
84
+ sd2-j: -1
85
+ switch /default sd2-i [
86
+ 1 [sd2-j: 1 ]
87
+ 2 [sd2-j: 2 ]
88
+ ][
89
+ sd2-j: 0
90
+ ]
91
+ --assert sd2-j = 0
92
+
93
+ --test-- "switch-default-3"
94
+ sd3-i: "hello"
95
+ sd3-j: -1
96
+ switch /default sd3-i [
97
+ 1 [sd3-j: 1 ]
98
+ 2 [sd3-j: 2 ]
99
+ ][
100
+ sd3-j: 0
101
+ ]
102
+ --assert sd3-j = 0
103
+
104
+ ===end-group===
105
+
106
+ ===start-group=== "switch-all" ;; not sure if it will be implemented.
107
+ comment {
108
+ --test-- "switch-all-1"
109
+ sa1-i: 1
110
+ sa1-j: 0
111
+ switch/all sa1-i [
112
+ 0 [sa1-j: sa1-j + 1]
113
+ 1 [sa1-j: sa1-j + 2]
114
+ 2 [sa1-j: sa1-j + 4]
115
+ ]
116
+ --assert sa1-j = 6
117
+ }
118
+
119
+ ===end-group===
28
120
121
+ ===start-group=== "switch-multi" ;; not sure if it will be implemented.
29
122
123
+ --test-- "switch-multi-1"
124
+ sm1-i: 2
125
+ sm1-j: 0
126
+ switch sm1-i [
127
+ 1 2 [sm1-j: 1 ]
128
+ ]
129
+ --assert sm1-j = 1
130
+
30
131
===end-group===
31
132
32
133
~~~end-file~~~
You can’t perform that action at this time.
0 commit comments