aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 8f0f20cdf5..87de1c9fe5 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1,3 +1,6 @@
+const std = @import("std");
+const expect = std.testing.expect;
+
// normal comment
/// this is a documentation comment
@@ -7,3 +10,11 @@ fn emptyFunctionWithComments() void {}
test "empty function with comments" {
emptyFunctionWithComments();
}
+
+test "truncate" {
+ try expect(testTruncate(0x10fd) == 0xfd);
+ comptime try expect(testTruncate(0x10fd) == 0xfd);
+}
+fn testTruncate(x: u32) u8 {
+ return @truncate(u8, x);
+}