Files
ww/lib/strings/suffix_test.ww
Hojun-Cho aadc6618f0 lib: banner purge + WHY-only comment sweep (rule 8)
Every // ---- section banner dies (132 -> 0): names carry the WHAT.
Narration deleted (filename restatements, run-with lines, what-the-
next-line-does); every ref/hare cite, task cite, divergence, ABI/
layout contract, and ownership qualifier kept (borrowed-view lines
restored where the sweep over-cut). Comment-only proven: all 442
walk-workdir .s and 32 import-probe .s byte-identical before/after;
libbyteid 56-roster all-ID.
2026-08-08 21:10:18 +09:00

32 lines
1.2 KiB
Plaintext

// Vectors mirror ref/hare/strings/suffix.ha (task #5 @test conversion).
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
};