diff options
| author | 2026-10-15 15:00:36 +0330 | |
|---|---|---|
| committer | 2026-10-15 15:00:36 +0330 | |
| commit | a5a5029a80a14be46c244b5bcca63e5e2cd9026f (patch) | |
| tree | 9ba84a7d2c5c0f8bdbba65eb9df57b6129c132e7 /tests | |
| parent | TODO: implicit namespace at the top (diff) | |
std.Io.print/println take any mix of printable arguments (compiler expands per type); docs, conformance
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conformance/3-expressions/print_varargs.zc | 14 | ||||
| -rw-r--r-- | tests/conformance/3-expressions/print_varargs_fresh_object.zc | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/conformance/3-expressions/print_varargs.zc b/tests/conformance/3-expressions/print_varargs.zc new file mode 100644 index 0000000..6918c8c --- /dev/null +++ b/tests/conformance/3-expressions/print_varargs.zc @@ -0,0 +1,14 @@ +// expect: a b 42 -7 1.500000//name: zc/6/ +// spec 3.11.7 +include rt, std; +char* make_name() { char* s = rt.new(3); s[0] = 'z'; s[1] = 'c'; s[2] = 0; return s; } +fn main() { + float f = 1.5; + std.Io.print("a"); + std.Io.println(" b ", 42, " ", -7, " ", f); + std.Io.println(); + std.Io.println("name: ", make_name()); + int x = 3; + std.Io.println(x * 2); +} +// zc0: skip diff --git a/tests/conformance/3-expressions/print_varargs_fresh_object.zc b/tests/conformance/3-expressions/print_varargs_fresh_object.zc new file mode 100644 index 0000000..5cba2a4 --- /dev/null +++ b/tests/conformance/3-expressions/print_varargs_fresh_object.zc @@ -0,0 +1,6 @@ +// expect error: a new object can't be printed +// spec 3.11.7 +include rt, std; +struct node { int v; }; +fn main() { std.Io.println(rt.new(node)); } +// zc0: skip |
