Skip to content

Commit 458f599

Browse files
committed
FIX: making find case-insensitive by default on BITSET when used with a CHAR
resolves: Oldes/Rebol-issues#2166
1 parent b2f8031 commit 458f599

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/core/t-bitset.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600

601601
case A_PICK:
602602
case A_FIND:
603-
if (!Check_Bits(VAL_SERIES(value), arg,(action == A_FIND && D_REF(ARG_FIND_CASE)) ))
603+
if (!Check_Bits(VAL_SERIES(value), arg,(IS_CHAR(arg) && action == A_FIND && !D_REF(ARG_FIND_CASE)) ))
604604
#ifdef PICK_BITSET_AS_NONE
605605
return R_NONE;
606606
#else

src/tests/units/bitset-test.r3

+18
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,24 @@
208208
===end-group===
209209

210210

211+
===start-group=== "find"
212+
--test-- "find bitset! char!"
213+
;@@ https://github.com/Oldes/Rebol-issues/issues/2166
214+
ABC: charset [#"A" #"B" #"C"]
215+
--assert find ABC #"a"
216+
--assert find ABC #"A"
217+
--assert find/case ABC #"A"
218+
--assert not find/case ABC #"a"
219+
; finding integer value is always case-sensitive
220+
--assert find ABC to-integer #"A"
221+
--assert not find ABC to-integer #"a"
222+
; pick is always case-sensitive
223+
--assert pick ABC #"A"
224+
--assert not pick ABC #"a"
225+
226+
===end-group===
227+
228+
211229
===start-group=== "complemented"
212230

213231
--test-- "comp-1" --assert "make bitset! [not bits #{}]" = mold charset [not]

0 commit comments

Comments
 (0)