blob: f8d829547e8778ee8a6fad2256e1ca0a232c1d41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
project('if test', 'c')
var1 = true
set_variable('var2', false)
if var1
exe = executable('prog', 'prog.c')
endif
if var2
exe = executable('breakbreakbreak', 'crashing.c')
endif
test('iftest', exe)
if not is_variable('var1')
error('Is_variable fail.')
endif
if is_variable('nonexisting')
error('Is_variable fail 2.')
endif
if not get_variable('var1', false)
error('Get_variable fail.')
endif
if get_variable('nonexisting', false)
error('Get_variable fail.')
endif
# Now test elseif
t = true
f = false
if true
message('Ok.')
elif true
error('Error')
else
error('Error')
endif
if f
error('Error.')
elif t
message('Ok')
else
error('Error')
endif
if f
error('Error.')
elif false
error('Error')
else
message('Ok')
endif
# Test plain else
var = false
if var
exe = executable('break', 'break.c')
else
exe = executable('eprog', 'prog.c')
endif
test('elsetest', exe)
|