migrate all the temporary tests to new test file

This commit is contained in:
Andrew Kelley
2016-12-22 00:12:27 -05:00
parent d544672ed4
commit 56cc2e2b24
9 changed files with 152 additions and 117 deletions

30
test/cases3/struct.zig Normal file
View File

@@ -0,0 +1,30 @@
const StructWithNoFields = struct {
fn add(a: i32, b: i32) -> i32 { a + b }
};
const empty_global_instance = StructWithNoFields {};
fn callStructStaticMethod() {
@setFnTest(this);
const result = StructWithNoFields.add(3, 4);
assert(result == 7);
}
fn returnEmptyStructInstance() -> StructWithNoFields {
@setFnTest(this);
return empty_global_instance;
}
const should_be_11 = StructWithNoFields.add(5, 6);
fn invokeStaticMethodInGlobalScope() {
@setFnTest(this);
assert(should_be_11 == 11);
}
// TODO const assert = @import("std").debug.assert;
fn assert(ok: bool) {
if (!ok)
@unreachable();
}