| 153 | |
| 154 | |
| 155 | function shouldThrow(_a, _e) |
| 156 | { |
| 157 | var exception; |
| 158 | var _av; |
| 159 | try { |
| 160 | _av = eval(_a); |
| 161 | } catch (e) { |
| 162 | exception = e; |
| 163 | } |
| 164 | |
| 165 | var _ev; |
| 166 | if (_e) |
| 167 | _ev = eval(_e); |
| 168 | |
| 169 | if (exception) { |
| 170 | if (typeof _e == "undefined" || exception == _ev) |
| 171 | testPassed(_a + " threw exception " + exception + "."); |
| 172 | else |
| 173 | testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + "."); |
| 174 | } else if (typeof _av == "undefined") |
| 175 | testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined."); |
| 176 | else |
| 177 | testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + stringify(_av) + "."); |
| 178 | } |
| 179 | |
| 180 | |
| 181 | function shouldNotThrow(_a) |