fix int formatting in std::collections::object

This commit is contained in:
Denis Palashevskii
2024-10-05 13:17:18 +04:00
committed by Christoffer Lerno
parent 2ef1465244
commit 217151be8d
2 changed files with 19 additions and 1 deletions

View File

@@ -21,3 +21,21 @@ fn void test_general()
root.set("yyy", true);
assert(root.get_bool("yyy") ?? false);
}
fn void test_to_format_int()
{
{
Object* int_object = object::new_int(16, allocator::heap());
defer int_object.free();
String s = string::new_format("%s", int_object);
defer free(s);
assert(s == "16");
}
{
Object* int_object = object::new_int(-16, allocator::heap());
defer int_object.free();
String s = string::new_format("%s", int_object);
defer free(s);
assert(s == "-16");
}
}