24 lines
473 B
JavaScript
24 lines
473 B
JavaScript
description('Test for (foo in somethingWhichThrows) to catch ASSERT');
|
|
|
|
function throwNullException() {
|
|
throw null;
|
|
}
|
|
|
|
function throwUndefinedException() {
|
|
throw undefined;
|
|
}
|
|
|
|
function throwStringException() {
|
|
throw "PASSED"
|
|
}
|
|
|
|
function test(func) {
|
|
for (var foo in func()) {
|
|
testFailed("Shoud not be reached");
|
|
}
|
|
}
|
|
|
|
shouldBeUndefined("test(throwUndefinedException)");
|
|
shouldBeUndefined("test(throwNullException)");
|
|
shouldThrow("test(throwStringException)");
|