| 1 | //! By convention, root.zig is the root source file when making a package. |
| 2 | const std = @import("std"); |
| 3 | const Io = std.Io; |
| 4 | |
| 5 | /// This is a documentation comment to explain the `printAnotherMessage` function below. |
| 6 | /// |
| 7 | /// Accepting an `Io.Writer` instance is a handy way to write reusable code. |
| 8 | pub fn printAnotherMessage(writer: *Io.Writer) Io.Writer.Error!void { |
| 9 | try writer.print("Run `zig build test` to run the tests.\n", .{}); |
| 10 | } |
| 11 | |
| 12 | pub fn add(a: i32, b: i32) i32 { |
| 13 | return a + b; |
| 14 | } |
| 15 | |
| 16 | test "basic add functionality" { |
| 17 | try std.testing.expect(add(3, 7) == 10); |
| 18 | } |