aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/28 try compile/meson.build17
1 files changed, 12 insertions, 5 deletions
diff --git a/test cases/common/28 try compile/meson.build b/test cases/common/28 try compile/meson.build
index cb41e1d..3480d1d 100644
--- a/test cases/common/28 try compile/meson.build
+++ b/test cases/common/28 try compile/meson.build
@@ -8,20 +8,27 @@ breakcode = '''#include<nonexisting.h>
void func(void) { printf("This won't work.\n"); }
'''
-foreach compiler : [meson.get_compiler('c'), meson.get_compiler('cpp')]
- if compiler.compiles(code, name : 'should succeed') == false
+foreach lang : ['c', 'cpp']
+ compiler = meson.get_compiler(lang)
+
+ if compiler.compiles(code, name : 'code should succeed') == false
+ error('Compiler ' + compiler.get_id() + ' is fail.')
+ endif
+
+ if compiler.compiles(files('valid.c'), name : 'file should succeed') == false
error('Compiler ' + compiler.get_id() + ' is fail.')
endif
- if compiler.compiles(files('valid.c'), name : 'should succeed') == false
+ copied = configure_file(input: 'valid.c', output: lang + '-valid-copy.c', copy: true)
+ if compiler.compiles(copied, name : 'built file should succeed') == false
error('Compiler ' + compiler.get_id() + ' is fail.')
endif
- if compiler.compiles(breakcode, name : 'should fail')
+ if compiler.compiles(breakcode, name : 'code should fail')
error('Compiler ' + compiler.get_id() + ' returned true on broken code.')
endif
- if compiler.compiles(files('invalid.c'), name : 'should fail')
+ if compiler.compiles(files('invalid.c'), name : 'file should fail')
error('Compiler ' + compiler.get_id() + ' returned true on broken code.')
endif
endforeach