| 1 | // vtest vflags: -d new_1 -d new_a_1 -d new_b_1 -d new_c_1 -d new_d_1 -d new_e_1 |
| 2 | module main |
| 3 | |
| 4 | // this is comment, should skip |
| 5 | |
| 6 | $if new_1 ? { |
| 7 | // this is comment, should skip |
| 8 | import os |
| 9 | // this is comment, should skip |
| 10 | } $else $if new_2 ? { |
| 11 | // this is comment, should skip |
| 12 | import math |
| 13 | // this is comment, should skip |
| 14 | } $else { |
| 15 | // this is comment, should skip |
| 16 | import time |
| 17 | // this is comment, should skip |
| 18 | } |
| 19 | // this is comment, should skip |
| 20 | |
| 21 | const t = $if amd64 { 1 } $else { 2 } |
| 22 | |
| 23 | $if new_a_1 ? { |
| 24 | pub type Digits = u64 |
| 25 | } $else $if new_a_2 ? { |
| 26 | pub type Digits = u32 |
| 27 | } $else { |
| 28 | pub type Digits = u8 |
| 29 | } |
| 30 | |
| 31 | $if new_b_1 ? { |
| 32 | pub const const1 = '123' |
| 33 | } $else $if new_b_2 ? { |
| 34 | pub const const1 = 123 |
| 35 | } $else { |
| 36 | pub const const1 = 1.1 |
| 37 | } |
| 38 | |
| 39 | $if new_c_1 ? { |
| 40 | pub enum Enum1 { |
| 41 | enum1_a |
| 42 | enum1_b |
| 43 | } |
| 44 | } $else $if new_c_2 ? { |
| 45 | pub enum Enum1 { |
| 46 | enum1_c |
| 47 | enum1_d |
| 48 | } |
| 49 | } $else { |
| 50 | pub enum Enum1 { |
| 51 | enum1_e |
| 52 | enum1_f |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | $if new_d_1 ? { |
| 57 | pub struct Struct1 { |
| 58 | a int |
| 59 | } |
| 60 | } $else $if new_d_2 ? { |
| 61 | pub struct Struct1 { |
| 62 | b int |
| 63 | } |
| 64 | } $else { |
| 65 | pub struct Struct1 { |
| 66 | c int |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | $if new_e_1 ? { |
| 71 | pub fn ret() string { |
| 72 | return 'new_e_1' |
| 73 | } |
| 74 | } $else $if new_e_2 ? { |
| 75 | pub fn ret() string { |
| 76 | return 'new_e_2' |
| 77 | } |
| 78 | } $else { |
| 79 | pub fn ret() string { |
| 80 | return 'new_e_3' |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | fn test_main() { |
| 85 | assert os.user_os().len > 0 |
| 86 | assert t in [1, 2] |
| 87 | assert sizeof(Digits) == 8 // Digits == u64 |
| 88 | assert const1 == '123' |
| 89 | _ := Enum1.enum1_a // should compile |
| 90 | _ := Struct1{ |
| 91 | a: 123 |
| 92 | } // should compile |
| 93 | assert ret() == 'new_e_1' |
| 94 | } |
| 95 | |