diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-04 16:57:22 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-04 16:57:22 -0700 |
| commit | 4514661cfef1cd0090ba9888b69037af3ef9805a (patch) | |
| tree | a298e8c90440837a9cbf7ec83d9c6408ca59c768 /test/run_tests.cpp | |
| parent | fcacc85b4e7f0a60ae11bbefcdae620665426297 (diff) | |
| download | zig-4514661cfef1cd0090ba9888b69037af3ef9805a.tar.gz zig-4514661cfef1cd0090ba9888b69037af3ef9805a.zip | |
add member functions
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 1cb837753a..18f0f3902d 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -56,7 +56,6 @@ static TestCase *add_simple_case(const char *case_name, const char *source, cons test_case->compiler_args.append(tmp_exe_path); test_case->compiler_args.append("--release"); test_case->compiler_args.append("--strip"); - //test_case->compiler_args.append("--verbose"); test_case->compiler_args.append("--color"); test_case->compiler_args.append("on"); @@ -740,6 +739,24 @@ pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { return 0; } )SOURCE", "2\n"); + + add_simple_case("member functions", R"SOURCE( +use "std.zig"; +struct Rand { + seed: u32, + pub fn get_seed(r: Rand) -> u32 { + r.seed + } +} +pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { + const r = Rand {.seed = 1234}; + if (r.get_seed() != 1234) { + print_str("BAD seed\n"); + } + print_str("OK\n"); + return 0; +} + )SOURCE", "OK\n"); } //////////////////////////////////////////////////////////////////////////////////// |
