mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
First 0.7 update, removing all deprecated features.
This commit is contained in:
committed by
Christoffer Lerno
parent
cff6697818
commit
2a895ec7be
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user