zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_type_coercion.zig (321B) - Raw


      1 test "type coercion - variable declaration" {
      2     const a: u8 = 1;
      3     const b: u16 = a;
      4     _ = b;
      5 }
      6 
      7 test "type coercion - function call" {
      8     const a: u8 = 1;
      9     foo(a);
     10 }
     11 
     12 fn foo(b: u16) void {
     13     _ = b;
     14 }
     15 
     16 test "type coercion - @as builtin" {
     17     const a: u8 = 1;
     18     const b = @as(u16, a);
     19     _ = b;
     20 }
     21 
     22 // test