File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,11 @@ static void No_Nones_Or_Logic(REBVAL *arg) {
139
139
cnt = 0 ;
140
140
value = BLK_SKIP (series , index );
141
141
for (val = VAL_BLK_DATA (target ); NOT_END (val ); val ++ , value ++ ) {
142
- if (0 != Cmp_Value (value , val , (REBOOL )(flags & AM_FIND_CASE ))) break ;
142
+ if ((flags & AM_FIND_SAME )) {
143
+ if (0 == Compare_Values (value , val , 3 ))
144
+ break ;
145
+ }
146
+ else if (0 != Cmp_Value (value , val , (REBOOL )(flags & AM_FIND_CASE ))) break ;
143
147
if (++ cnt >= len ) {
144
148
return index ;
145
149
}
Original file line number Diff line number Diff line change @@ -275,6 +275,23 @@ Rebol [
275
275
--assert 2 = index? find/same [1.0 1 ] 1
276
276
--assert 1 = index? find/same [1.0 1 ] 1.0
277
277
278
+ --test-- "FIND block! block!"
279
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2473
280
+ blk: [1.0 3 1 3 1.0 2.0 1 2 ]
281
+ --assert 5 = index? find blk [1 2 ]
282
+ --assert 1 = index? find blk [1 3 ]
283
+ --assert 5 = index? find blk [1.0 2 ]
284
+ --assert 7 = index? find/same blk [1 2 ]
285
+ --assert 3 = index? find/same blk [1 3 ]
286
+ --assert none? find/same blk [1.0 2 ]
287
+ a: "a" b: "b" blk: reduce ["a" "b" a b]
288
+ --assert 1 = index? find blk reduce [a b]
289
+ --assert 1 = index? find blk reduce ["a" "b" ]
290
+ --assert 3 = index? find/same blk reduce [a b]
291
+ --assert none? find/same blk reduce [a "b" ]
292
+ --assert none? find/same blk reduce ["a" "b" ]
293
+
294
+
278
295
--test-- "FIND/SAME in string!"
279
296
--assert "AbcdAe" = find/same "aAbcdAe" "A"
280
297
--assert "Ae" = find/same/last "aAbcdAe" "A"
You can’t perform that action at this time.
0 commit comments