diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-07-27 14:18:11 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-07-27 14:18:11 +0300 |
commit | 427cfbf569113aeab6b98b96c8e9c3cf2532e8ae (patch) | |
tree | 39352df0eb537d815b425581f673ff55d3462d28 /test cases | |
parent | 208e0122fb2b166c7c29463c31a785935ca30a04 (diff) | |
download | meson-427cfbf569113aeab6b98b96c8e9c3cf2532e8ae.zip meson-427cfbf569113aeab6b98b96c8e9c3cf2532e8ae.tar.gz meson-427cfbf569113aeab6b98b96c8e9c3cf2532e8ae.tar.bz2 |
Interpreter side of tryrun is mostly done.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/39 tryrun/meson.build | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test cases/common/39 tryrun/meson.build b/test cases/common/39 tryrun/meson.build new file mode 100644 index 0000000..7f4cdad --- /dev/null +++ b/test cases/common/39 tryrun/meson.build @@ -0,0 +1,59 @@ +project('tryrun', 'c') + +cc = meson.get_compiler('c') + +ok_code = '''#include<stdio.h> +int main(int argc, char **argv) { + printf("%s\n", "stdout"); + fprintf(stderr, "%s\n", "stderr"); + return 0; +} +''' + +error_code = '''int main(int argc, char **argv) { + return 1; +} +''' + +no_compile_code = '''int main(int argc, char **argv) { +''' + +ok = cc.run(ok_code) +err = cc.run(error_code) +noc = cc.run(no_compile_code) + +if noc.compiled() + message('Compilation fail test failed.') +else + error('Fail detected.') +endif + +if ok.compiled() + message('Compilation worked.') +else + error('Compilation did not work.') +endif + +if ok.returncode() == 0 + message('Return code ok.') +else + error('Return code fail') +endif + +if err.returncode() == 1 + message('Bad return code ok.') +else + error('Bad return code fail.') +endif + +if ok.stdout().strip() == 'stdout' + message('Stdout ok.') +else + message('Bad stdout.') +endif + +if ok.stderr().strip() == 'stderr' + message('Stderr ok.') +else + message('Bad stderr.') +endif |