First 0.7 update, removing all deprecated features.

This commit is contained in:
Christoffer Lerno
2025-02-27 14:16:36 +01:00
committed by Christoffer Lerno
parent cff6697818
commit 2a895ec7be
1589 changed files with 2635 additions and 115363 deletions

View File

@@ -98,10 +98,10 @@ fn void base32_api()
{
foreach (t : std_tests)
{
String got = base32::encode_temp(t.dec)!!;
String got = base32::tencode(t.dec)!!;
assert(got == t.enc, "got: %s, want: %s", got, t.enc);
char[] got_chars = base32::decode_temp(t.enc)!!;
char[] got_chars = base32::tdecode(t.enc)!!;
assert(got_chars == t.dec, "got: %s, want: %s", got_chars, t.dec);
}
};

View File

@@ -59,7 +59,7 @@ fn void csv_row()
};
CsvReader r;
r.init((ByteReader){}.init(t.input), t.sep);
CsvRow row = r.read_temp_row()!!;
CsvRow row = r.tread_row()!!;
assert(row.list.len == t.want.len, "not enough records found");
for (int i = 0; i < row.list.len; i++) {
assert(row.list[i] == t.want[i],"columns do not match; "

View File

@@ -24,11 +24,11 @@ fn void encode()
foreach (t : tests)
{
n = hex::encode_bytes(t.dec, buf[..]);
String want = ((String)t.enc).temp_ascii_to_lower();
String want = ((String)t.enc).to_lower_tcopy();
assert(want == buf[:n], "encode failed: got: %s, want: %s", buf[:n], want);
@pool()
{
assert(want == hex::encode_temp(t.dec));
assert(want == hex::tencode(t.dec));
};
}
}
@@ -43,7 +43,7 @@ fn void decode()
assert(t.dec == buf[:n], "decode failed: got: %s, want: %s", buf[:n], t.dec);
@pool()
{
assert(t.dec == hex::decode_temp(t.enc)!!);
assert(t.dec == hex::tdecode(t.enc)!!);
};
}
}

View File

@@ -7,7 +7,7 @@ fn void simple_test()
{
ByteReader reader;
reader.init(`{ "b": 123, "c": [ { "d": 66 }, null, "hello\tworld", false, { "id": "xyz" } ] }`);
Object* o = json::parse(&reader)!!;
Object* o = json::parse(mem, &reader)!!;
defer o.free();
assert(o.get_int("b")!! == 123);
assert(o.get("c").get_len()!! == 5);
@@ -22,17 +22,17 @@ fn void simple_test2()
{
ByteReader reader;
reader.init(`{"jsonrpc":"2.0","id":null,"method":"initialize"}`);
Object* o = json::parse(&reader)!!;
Object* o = json::parse(mem, &reader)!!;
defer o.free();
}
fn void test_string()
{
Object* o = json::parse_string(`{"jsonrpc":"2","id":null,"method":"initialize"}`)!!;
Object* o = json::parse_string(mem, `{"jsonrpc":"2","id":null,"method":"initialize"}`)!!;
defer o.free();
String s = string::tformat("%s", *o);
Object* o2 = json::parse_string(s)!!;
Object* o2 = json::parse_string(mem, s)!!;
defer o2.free();
String s2 = string::tformat("%s", *o2);
assert(s2 == s, "Unexpectedly got %s and not %s", s2, s);
@@ -42,10 +42,10 @@ fn void test_temp_string()
{
@pool()
{
Object* o = json::temp_parse_string(`{"jsonrpc":"2","id":null,"method":"initialize"}`)!!;
Object* o = json::tparse_string(`{"jsonrpc":"2","id":null,"method":"initialize"}`)!!;
defer o.free();
String s = string::tformat("%s", *o);
Object* o2 = json::temp_parse_string(s)!!;
Object* o2 = json::tparse_string(s)!!;
defer o2.free();
String s2 = string::tformat("%s", *o2);
assert(s2 == s, "Unexpectedly got %s and not %s", s2, s);