// suffixtest — exercises strings.hasprefix/hassuffix. A failing row // aborts via the assert/abort builtin (task #5 @test conversion). // Vectors mirror ref/hare/strings/suffix.ha. package strings_test; import strings; // ref/hare/strings/suffix.ha:18. @test fn hasprefix_cases() void = { assert(!(!strings.hasprefix("hello world", "hello"))); assert(!(!strings.hasprefix("hello world", 'h'))); assert(!( strings.hasprefix("hello world", "world"))); assert(!( strings.hasprefix("hello world", 'q'))); assert(!(!strings.hasprefix("hello", "hello"))); // equal-len assert(!(!strings.hasprefix("anything", ""))); // empty prefix assert(!( strings.hasprefix("", "x"))); // multibyte rune prefix — '\'é\'' literal blocked by single-byte // lexrune (lib/ww/lex/lex.ww:659); pass codepoint directly. assert(!(!strings.hasprefix("éclat", 0xE9u32: rune))); assert(!(!strings.hasprefix("🦀rust", 0x1F980u32: rune))); }; // ref/hare/strings/suffix.ha:36. @test fn hassuffix_cases() void = { assert(!(!strings.hassuffix("hello world", "world"))); assert(!(!strings.hassuffix("hello world", 'd'))); assert(!( strings.hassuffix("hello world", "hello"))); assert(!( strings.hassuffix("hello world", 'h'))); assert(!(!strings.hassuffix("café", 0xE9u32: rune))); // multibyte };