test: update tests

This commit is contained in:
2025-11-01 10:04:41 +00:00
parent 9e21e0c4b2
commit a68b9f7ba7
7 changed files with 58 additions and 42 deletions

View File

@@ -12,11 +12,9 @@ void write_raw_string(const b_string *data)
{
b_stream_write_string(b_stdout, "\"", NULL);
b_string_iterator it;
b_string_foreach(&it, data)
const b_iterator *it = b_iterator_cbegin(data);
b_foreach_c(b_wchar, c, it)
{
b_wchar c = it.char_value;
if (c >= 0x10000) {
c -= 0x10000;
long hi = 0xD800 | ((c >> 10) & 0x3FF);
@@ -30,6 +28,7 @@ void write_raw_string(const b_string *data)
b_stream_write_char(b_stdout, c);
}
}
b_iterator_unref(it);
b_stream_write_string(b_stdout, "\"", NULL);
}
@@ -134,17 +133,18 @@ void write_tagged_dict(b_dict *data)
int i = 0;
b_dict_iterator it;
b_dict_foreach(&it, data)
b_iterator *it = b_iterator_begin(data);
b_foreach(b_dict_item *, item, it)
{
if (i++ > 0) {
b_stream_write_string(b_stdout, ", ", NULL);
}
write_raw_string(it.key);
write_raw_string(item->key);
b_stream_write_string(b_stdout, ": ", NULL);
write_tagged_value(it.value);
write_tagged_value(item->value);
}
b_iterator_unref(it);
b_stream_write_string(b_stdout, " }", NULL);
}
@@ -154,15 +154,16 @@ void write_tagged_array(b_array *data)
b_stream_write_string(b_stdout, "[ ", NULL);
int i = 0;
b_array_iterator it;
b_array_foreach(&it, data)
b_iterator *it = b_iterator_begin(data);
b_foreach(b_object *, obj, it)
{
if (i++ > 0) {
b_stream_write_string(b_stdout, ", ", NULL);
}
write_tagged_value(it.value);
write_tagged_value(obj);
}
b_iterator_unref(it);
b_stream_write_string(b_stdout, " ]", NULL);
}