diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-11-15 22:52:47 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-11-15 22:52:47 -0500 |
| commit | 018cbff438cedc19d0ad18021619ec7ede997307 (patch) | |
| tree | e21110319947f172100bda3b62685d2857c1fcdb /test/cases | |
| parent | f276fd0f3728bf1a43b185e3e2d33d593309cb2f (diff) | |
| download | zig-018cbff438cedc19d0ad18021619ec7ede997307.tar.gz zig-018cbff438cedc19d0ad18021619ec7ede997307.zip | |
unions have a secret field for the type
See #144
Diffstat (limited to 'test/cases')
| -rw-r--r-- | test/cases/union.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/cases/union.zig b/test/cases/union.zig index 74bda8db6a..377374c157 100644 --- a/test/cases/union.zig +++ b/test/cases/union.zig @@ -44,3 +44,16 @@ test "basic unions" { foo.float = 12.34; assert(foo.float == 12.34); } + + +const FooExtern = extern union { + float: f64, + int: i32, +}; + +test "basic extern unions" { + var foo = FooExtern { .int = 1 }; + assert(foo.int == 1); + foo.float = 12.34; + assert(foo.float == 12.34); +} |
