structs are working

This commit is contained in:
Andrew Kelley
2015-12-12 22:55:29 -07:00
parent 0f02e29a2b
commit bd77bc749a
5 changed files with 127 additions and 93 deletions

View File

@@ -477,6 +477,27 @@ export fn main(argc : isize, argv : *mut *mut u8, env : *mut *mut u8) -> i32 {
}
)SOURCE", "OK\n");
add_simple_case("structs", R"SOURCE(
use "std.zig";
export fn main(argc : isize, argv : *mut *mut u8, env : *mut *mut u8) -> i32 {
let mut foo : Foo;
foo.a = foo.a + 1;
foo.b = foo.a == 1;
test_foo(foo);
return 0;
}
struct Foo {
a : i32,
b : bool,
c : f32,
}
fn test_foo(foo : Foo) {
if foo.b {
print_str("OK\n" as string);
}
}
)SOURCE", "OK\n");
}
static void add_compile_failure_test_cases(void) {