mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
21 lines
422 B
Plaintext
21 lines
422 B
Plaintext
module std::core::formatter_test;
|
|
|
|
import std;
|
|
|
|
struct Foo (Printable) { int a; }
|
|
fn usz? Foo.to_format(&self, Formatter *f) @dynamic
|
|
{
|
|
return f.printf("Foo[%d]", self.a);
|
|
}
|
|
|
|
fn void test_ref() @test
|
|
{
|
|
Foo* f = &&(Foo){ 8 };
|
|
Foo* f0 = null;
|
|
int* a = (void*)(uptr)0x40;
|
|
int* b = null;
|
|
String s = string::format(mem, "%s %s %s %s %s", a, b, f0, f, *f);
|
|
defer free(s);
|
|
assert(s == "0x40 0x0 (null) Foo[8] Foo[8]");
|
|
}
|