Removing use of $assignable and deprecate it. Fix regression for stacktraces on MacOS. Added readline_to_stream. Regression: Chaining an optional together with contracts could in some cases lose the optional.

This commit is contained in:
Christoffer Lerno
2025-07-21 03:20:40 +02:00
parent 382a65abcd
commit 869bcf8b2b
18 changed files with 116 additions and 69 deletions

View File

@@ -36,7 +36,7 @@ fn void test_parent()
p.free();
}
fn void test_path_normalized() => mem::@scoped(allocator::temp())
fn void test_path_normalized() => mem::@scoped(tmem)
{
assert(path::new(mem, "", path_env: PathEnv.WIN32).str_view()!! == "");
assert(@catch(path::new(mem, "1:\\a\\b\\c.txt", path_env: PathEnv.WIN32)));
@@ -212,7 +212,7 @@ fn void test_path_normalized() => mem::@scoped(allocator::temp())
}
fn void test_extension() => mem::@scoped(allocator::temp())
fn void test_extension() => mem::@scoped(tmem)
{
assert(@catch(path::new(mem, `C:`, path_env: PathEnv.WIN32).extension()));
assert(@catch(path::new(mem, `C:`, path_env: PathEnv.POSIX).extension()));
@@ -246,7 +246,7 @@ fn void test_extension() => mem::@scoped(allocator::temp())
}
fn void test_has_extension() => mem::@scoped(allocator::temp())
fn void test_has_extension() => mem::@scoped(tmem)
{
assert(!path::new(mem, `C:\temp\foo.bar\README`, path_env: PathEnv.WIN32)!!.has_extension(`bar\README`));
@@ -276,7 +276,7 @@ fn void test_has_extension() => mem::@scoped(allocator::temp())
}
fn void test_basename() => mem::@scoped(allocator::temp())
fn void test_basename() => mem::@scoped(tmem)
{
assert(path::for_windows(mem, "file.txt").basename()!! == "file.txt");
assert(path::for_posix(mem, "file.txt").basename()!! == "file.txt");
@@ -303,7 +303,7 @@ fn void test_basename() => mem::@scoped(allocator::temp())
assert(path::for_posix(mem, `\\server\abc`).basename()!! == `\\server\abc`);
}
fn void test_dirname() => mem::@scoped(allocator::temp())
fn void test_dirname() => mem::@scoped(tmem)
{
assert(path::for_posix(mem, "").dirname()!! == ".");
assert(path::for_posix(mem, "/file").dirname()!! == "/");
@@ -343,7 +343,7 @@ fn void test_dirname() => mem::@scoped(allocator::temp())
assert(path::for_posix(mem, `\\server\`).dirname()!! == `.`);
}
fn void test_path_volume() => mem::@scoped(allocator::temp())
fn void test_path_volume() => mem::@scoped(tmem)
{
assert(path::for_windows(mem, `C:\abs`).volume_name()!! == `C:`);
assert(path::for_windows(mem, `C:abs`).volume_name()!! == `C:`);
@@ -353,7 +353,7 @@ fn void test_path_volume() => mem::@scoped(allocator::temp())
assert(path::for_windows(mem, `\\server\foo\abc`).volume_name()!! == `\\server\foo`);
}
fn void test_path_is_absolute() => mem::@scoped(allocator::temp())
fn void test_path_is_absolute() => mem::@scoped(tmem)
{
assert(!path::for_posix(mem, "").is_absolute()!!);
assert(path::for_posix(mem, "/").is_absolute()!!);
@@ -367,7 +367,7 @@ fn void test_path_is_absolute() => mem::@scoped(allocator::temp())
assert(path::for_windows(mem, `\\server\foo\abc`).is_absolute()!!);
}
fn void test_path_absolute() => mem::@scoped(allocator::temp())
fn void test_path_absolute() => mem::@scoped(tmem)
{
$if env::WIN32:
assert(path::for_windows(mem, `C:\abs`).absolute(mem, )!!.str_view() == `C:\abs`);

View File

@@ -75,7 +75,7 @@ fn void write_short_bytearray_test()
fn void read_tiny_bytearray_test()
{
ByteReader reader = io::wrap_bytes(&&x'07aabbcc00112233');
char[] read = io::read_tiny_bytearray(&reader, allocator: allocator::heap())!!;
char[] read = io::read_tiny_bytearray(&reader, allocator: mem)!!;
assert(read == &&x'aabbcc00112233');
free(read);
}
@@ -83,7 +83,7 @@ fn void read_tiny_bytearray_test()
fn void read_short_bytearray_test()
{
ByteReader reader = io::wrap_bytes(&&x'0007aabbcc00112233');
char[] read = io::read_short_bytearray(&reader, allocator: allocator::heap())!!;
char[] read = io::read_short_bytearray(&reader, allocator: mem)!!;
assert(read == &&x'aabbcc00112233');
free(read);
}