const expect = @import("std").testing.expect; const Payload = union { int: i64, float: f64, boolean: bool, }; test "simple union" { var payload = Payload{ .int = 1234 }; expect(payload.int == 1234); // Nope this is not how it works. // payload.float = 12.34; payload = Payload{ .float = 12.34 }; expect(payload.float == 12.34); }