Suppor slicing of bytes.

This commit is contained in:
Christoffer Lerno
2024-09-21 22:56:27 +02:00
parent 885acdac24
commit f66f324e0e
4 changed files with 47 additions and 4 deletions

View File

@@ -1,5 +1,14 @@
module ct_slice @test;
fn void! slice_bytes()
{
char[4] $a = x'aabbccdd';
var $b = $a[1..2];
char[2] y = $b;
assert($b == char[] { 187, 204 });
assert(y == char[2] { 187, 204 });
}
fn void! slice_string()
{
String $a = "abcd";