Files
ww/test/wcc/data/r700_strings_byteindex/case.ww
Hojun-Cho 956246b3f0 test: migrate 700_e2e rows to corpus fixtures; retire the carrier
136 rows migrated, 0 already owned, 3 wwstage-failing rows held out.
2026-08-08 14:10:46 +09:00

20 lines
517 B
Plaintext

//ww:run-exit 10
// Migrated from 700_e2e row 100.
package main;
import strings;
fn pick(r: (i32 | void), miss: i32) i32 = {
match (r) {
case let i: i32 => return i;
case void => return miss;
};
return 0;
};
fn main() i32 = {
let s: str = "hello, world";
let i1: i32 = pick(strings.byteindex(s, ','), -1);
let i2: i32 = pick(strings.byteindex(s, 'z'), -1);
let i3: i32 = pick(strings.byteindex(s, "world"), -1);
let i4: i32 = pick(strings.byteindex(s, "nope"), -1);
return i1 + i2 + i3 + i4;
};