commit 81b7d9444390fe15a66b2883effb2b9adb0eebc9
parent 16153ce9f0f9e4975534470dc55ccf641118f7d8
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date: Thu, 18 Mar 2021 16:25:56 +0100
tests: string constants with null terminator
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/tests/04-strings.ha b/tests/04-strings.ha
@@ -2,6 +2,8 @@ fn measurements() void = {
const x = "Hello!";
assert(len(x) == 6);
assert(len("Hello!") == 6);
+ assert(len("Hello!\0") == 7);
+ assert(len("He\0llo!") == 7);
assert(size(str) == size(*u8) + size(size) * 2);
const align: size =
if (size(*u8) > size(size)) size(*u8)
@@ -62,6 +64,7 @@ fn equality() void = {
assert("foo" != "bar");
assert("foo" != "foobar");
assert("foobar" == "foobar");
+ assert("foo\0bar" != "foo\0foo");
};
export fn main() void = {