diff options
Diffstat (limited to 'tests/std')
-rw-r--r-- | tests/std/io.toc | 8 | ||||
-rw-r--r-- | tests/std/mem.toc | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/std/io.toc b/tests/std/io.toc index 2b9e999..c274631 100644 --- a/tests/std/io.toc +++ b/tests/std/io.toc @@ -32,7 +32,13 @@ writei ::= fn(x: int) { if x == 0 { toc_putchar('0'); } else { - abs ::= fn(x: int) int { if x < 0 { -x } else { x } }; + abs ::= fn(x: int) int { + if x < 0 { + return -x; + } else { + return x; + } + }; scan_digit := 1000000000000000000; started := false; while scan_digit > 0 { diff --git a/tests/std/mem.toc b/tests/std/mem.toc index ef4e638..9ea9b12 100644 --- a/tests/std/mem.toc +++ b/tests/std/mem.toc @@ -5,14 +5,14 @@ calloc ::= #foreign("calloc", base.libc) fn(#C size_t, #C size_t) #C &"void"; free ::= #foreign("free", base.libc) fn(#C &"void"); new ::= fn(t :: Type) &t { - calloc(1, (sizeof t) as #C size_t) + return calloc(1, (sizeof t) as #C size_t); } news ::= fn(t :: Type, n : int) []t { s: []t; s.data = calloc(n as #C size_t, (sizeof t) as #C size_t); s.len = n; - s + return s; } // TODO(eventually): use type information to make this just one function |