v2 / vlib / v / tests / comptime / comptime_if_glibc_test.v
21 lines · 19 sloc · 318 bytes · f55c2956fbd893cf22df1780724a2c4c436332e2
Raw
1fn test_comptime_if_glibc() {
2 mut x := 1
3 mut result := ''
4 $if glibc {
5 result += '+glibc'
6 x = 2
7 } $else {
8 result += '-glibc'
9 x = 3
10 }
11
12 $if !glibc {
13 result += '+!glibc'
14 } $else {
15 result += '-!glibc'
16 }
17
18 println(result)
19 assert result == '+glibc-!glibc' || result == '-glibc+!glibc'
20 println('done')
21}
22