| 1 | module main |
| 2 | |
| 3 | $if @MOD == 'main' { |
| 4 | const c1 = 'main' |
| 5 | } $else { |
| 6 | const c1 = 'other' |
| 7 | } |
| 8 | |
| 9 | $if @OS == 'linux' { |
| 10 | const os = 'linux' |
| 11 | } $else $if @OS == 'windows' { |
| 12 | const os = 'windows' |
| 13 | } $else { |
| 14 | const os = 'other' |
| 15 | } |
| 16 | |
| 17 | fn test_comptime_if_at_expr() { |
| 18 | assert c1 == 'main' |
| 19 | |
| 20 | $if linux { |
| 21 | assert os == 'linux' |
| 22 | } $else $if windows { |
| 23 | assert os == 'windows' |
| 24 | } $else { |
| 25 | assert os == 'other' |
| 26 | } |
| 27 | |
| 28 | dump(@FN) |
| 29 | $if @FN == 'test_comptime_if_at_expr' { |
| 30 | assert true |
| 31 | } $else { |
| 32 | assert false |
| 33 | } |
| 34 | } |
| 35 |