v2 / vlib / v / tests / consts / const_from_comptime_if_expr_test.v
19 lines · 16 sloc · 333 bytes · 8e35f4d9848f7ad35d857a187dddbfd2eca5e19d
Raw
1import term
2
3const color = $if windows {
4 term.bright_cyan('WINDOWS')
5} $else {
6 term.bright_green('UNIX')
7}
8
9fn test_const_from_comptime_if_expr() {
10 salutation := 'hello'
11 val := match salutation {
12 'hello' { color + ' some text' }
13 'goodbyte' { color + ' some other text' }
14 else { 'invalid' }
15 }
16
17 println(val)
18 assert true
19}
20