mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
31 lines
576 B
Plaintext
31 lines
576 B
Plaintext
module format_test;
|
|
import std::io;
|
|
|
|
interface Decl
|
|
{
|
|
}
|
|
|
|
struct TestS (Decl, Printable)
|
|
{
|
|
int a;
|
|
}
|
|
fn usz? TestS.to_format(&self, Formatter* formatter) @dynamic => formatter.printf("[%d]", self.a);
|
|
|
|
faultdef DERP;
|
|
|
|
fn void various_cornercases() @test
|
|
{
|
|
TestS a = {100};
|
|
Decl z = &a;
|
|
test::eq(string::tformat("%s", z), "[100]");
|
|
|
|
fault p; fault o = DERP;
|
|
test::eq(string::tformat("%s|%s", p, o), "(nofault)|format_test::DERP");
|
|
|
|
Decl y;
|
|
test::eq(string::tformat("%s", y), "(null)");
|
|
|
|
int* x;
|
|
test::eq(string::tformat("%s", x), "0x0");
|
|
}
|