eric@webkit.org | b397517 | 2007-12-27 22:20:18 +0000 | [diff] [blame] | 1 | description('Test for (foo in somethingWhichThrows) to catch ASSERT'); |
| 2 | |
| 3 | function throwNullException() { |
| 4 | throw null; |
| 5 | } |
| 6 | |
| 7 | function throwUndefinedException() { |
| 8 | throw undefined; |
| 9 | } |
| 10 | |
| 11 | function throwStringException() { |
| 12 | throw "PASSED" |
| 13 | } |
| 14 | |
| 15 | function test(func) { |
| 16 | for (var foo in func()) { |
| 17 | testFailed("Shoud not be reached"); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | shouldBeUndefined("test(throwUndefinedException)"); |
| 22 | shouldBeUndefined("test(throwNullException)"); |
| 23 | shouldThrow("test(throwStringException)"); |