mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
init-exe template: small improvements
This commit is contained in:
parent
fb0b9f05b3
commit
cbac7a0194
@ -1,7 +1,7 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
// Prints to stderr
|
||||
// Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
|
||||
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
|
||||
|
||||
// Prints to stdout
|
||||
@ -18,5 +18,5 @@ test "simple test" {
|
||||
var list = std.ArrayList(i32).init(std.testing.allocator);
|
||||
defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
|
||||
try list.append(42);
|
||||
try std.testing.expectEqual(list.pop(), 42);
|
||||
try std.testing.expectEqual(@as(i32, 42), list.pop());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user