zig/test/behavior/bugs/5398.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

32 lines
847 B
Zig

const std = @import("std");
const testing = std.testing;
pub const Mesh = struct {
id: u32,
};
pub const Material = struct {
transparent: bool = true,
emits_shadows: bool = true,
render_color: bool = true,
};
pub const Renderable = struct {
material: Material,
// The compiler inserts some padding here to ensure Mesh is correctly aligned.
mesh: Mesh,
};
var renderable: Renderable = undefined;
test "assignment of field with padding" {
renderable = Renderable{
.mesh = Mesh{ .id = 0 },
.material = Material{
.transparent = false,
.emits_shadows = false,
},
};
testing.expectEqual(false, renderable.material.transparent);
testing.expectEqual(false, renderable.material.emits_shadows);
testing.expectEqual(true, renderable.material.render_color);
}