fixed a segfault bug in index()/rindex() function handler which treated a byte character as a byte string.

enhanced code to handle BOB better
This commit is contained in:
2025-07-10 23:12:47 +09:00
parent 45a22eb5a4
commit 955210800e
13 changed files with 296 additions and 32 deletions

View File

@ -405,6 +405,16 @@ function main()
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"\xAB"), 5, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xAB"), 2, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::rindex(@b"\xFFQ\xABX\xABZ", @b"Q\xABQ"), 0, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(str::frombcharcode(65), @b"B"), 0, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(str::frombcharcode(65), @b"A"), 1, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(str::frombcharcode(65), @b"B"), 0, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(str::frombcharcode(65), @b"A"), 1, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(@b'A', @b"B"), 0, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index(@b'A', @b"A"), 1, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index('A', @b"B"), 0, @SCRIPTNAME, @SCRIPTLINE);
tap_ensure (str::index('A', @b"A"), 1, @SCRIPTNAME, @SCRIPTLINE);
}
{