commit 38c8799c608dcdce53506185f89b21655a8c4195
parent be11c10c07d7115119c2f2d72ac561bd91a60c35
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Mon, 18 Apr 2022 22:06:36 +0200
ascii::validstr: fix octal literal
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ascii/valid.ha b/ascii/valid.ha
@@ -10,7 +10,7 @@ export fn valid(c: rune) bool = c: u32 <= 0o177;
export fn validstr(s: str) bool = {
const s = strings::toutf8(s);
for (let i = 0z; i < len(s); i += 1) {
- if (s[i] >= 0200) {
+ if (s[i] >= 0o200) {
return false;
};
};
@@ -21,6 +21,7 @@ export fn validstr(s: str) bool = {
assert(valid('a') && valid('\0') && valid('\x7F'));
assert(!valid('\x80') && !valid('こ'));
assert(validstr("abc\0"));
+ assert(!validstr("š"));
assert(!validstr("こんにちは"));
assert(!validstr("ABCこんにちは"));
};