|
1 | 1 | use QRegex;
|
2 | 2 |
|
3 |
| -plan(8); |
| 3 | +plan(15); |
4 | 4 |
|
5 | 5 | # Following a test infrastructure.
|
6 | 6 | sub compile_qast($qast) {
|
@@ -104,3 +104,72 @@ test_qast_result(
|
104 | 104 | ok($r[0].m eq 'a', 'op list works (first elem)');
|
105 | 105 | ok($r[1].m eq 'b', 'op list works (second elem)');
|
106 | 106 | });
|
| 107 | + |
| 108 | +is_qast( |
| 109 | + QAST::Block.new( |
| 110 | + QAST::Op.new( |
| 111 | + :op('if'), |
| 112 | + QAST::IVal.new(:value(1)), |
| 113 | + QAST::IVal.new(:value(2)), |
| 114 | + QAST::IVal.new(:value(3)) |
| 115 | + ) |
| 116 | + ), |
| 117 | + 2, |
| 118 | + 'if with IVal, 3-operand'); |
| 119 | + |
| 120 | +is_qast( |
| 121 | + QAST::Block.new( |
| 122 | + QAST::Op.new( |
| 123 | + :op('if'), |
| 124 | + QAST::IVal.new(:value(0)), |
| 125 | + QAST::IVal.new(:value(2)), |
| 126 | + QAST::IVal.new(:value(3)) |
| 127 | + ) |
| 128 | + ), |
| 129 | + 3, |
| 130 | + 'if with IVal, 3-operand'); |
| 131 | + |
| 132 | +is_qast( |
| 133 | + QAST::Block.new( |
| 134 | + QAST::Op.new( |
| 135 | + :op('if'), |
| 136 | + QAST::IVal.new(:value(1)), |
| 137 | + QAST::IVal.new(:value(2)) |
| 138 | + ) |
| 139 | + ), |
| 140 | + 2, |
| 141 | + 'if with IVal, 2-operand'); |
| 142 | + |
| 143 | +is_qast( |
| 144 | + QAST::Block.new( |
| 145 | + QAST::Op.new( |
| 146 | + :op('if'), |
| 147 | + QAST::IVal.new(:value(0)), |
| 148 | + QAST::IVal.new(:value(2)) |
| 149 | + ) |
| 150 | + ), |
| 151 | + 0, |
| 152 | + 'if with IVal, 2-operand'); |
| 153 | + |
| 154 | +is_qast( |
| 155 | + QAST::Block.new( |
| 156 | + QAST::Op.new( |
| 157 | + :op('unless'), |
| 158 | + QAST::IVal.new(:value(1)), |
| 159 | + QAST::IVal.new(:value(2)) |
| 160 | + ) |
| 161 | + ), |
| 162 | + 1, |
| 163 | + 'unless with IVal'); |
| 164 | + |
| 165 | +is_qast( |
| 166 | + QAST::Block.new( |
| 167 | + QAST::Op.new( |
| 168 | + :op('unless'), |
| 169 | + QAST::IVal.new(:value(0)), |
| 170 | + QAST::IVal.new(:value(2)) |
| 171 | + ) |
| 172 | + ), |
| 173 | + 2, |
| 174 | + 'unless with IVal'); |
| 175 | + |
0 commit comments