commit bfe91ff955dd20cb803bf5a5ff54de2470ea8b90
parent 3f5a5cfe69e91da99680e965365f3f239d6df436
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 5 Aug 2021 10:22:06 +0200
gen: expand tests/904-copy
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/tests/904-copy.ha b/tests/904-copy.ha
@@ -43,8 +43,23 @@ export fn main() int = {
assert(a.1 == b.1);
assert(a.2 == b.2);
- // strings, slices
- // TODO: Need casts to examine internals
+ let x = "hello world";
+ let y = x;
+ let px = &x: *struct {
+ data: *[*]u8,
+ length: size,
+ capacity: size,
+ };
+ let py = &y: *struct {
+ data: *[*]u8,
+ length: size,
+ capacity: size,
+ };
+ assert(px.length == py.length);
+ assert(px.capacity == py.capacity);
+ assert(px.data == py.data);
+
+ // TODO: Slices
return 0;
};