stage2: implement @truncate
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user