You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
565 B
22 lines
565 B
function expect(expression, expected) {
|
|
try {
|
|
var actual = eval(expression);
|
|
if (actual == expected) {
|
|
app.alert('PASS: ' + expression + ' = ' + actual);
|
|
} else {
|
|
app.alert('FAIL: ' + expression + ' = ' + actual + ', expected ' + expected + " ");
|
|
}
|
|
} catch (e) {
|
|
app.alert('ERROR: ' + e);
|
|
}
|
|
}
|
|
|
|
function expectError(expression) {
|
|
try {
|
|
var actual = eval(expression);
|
|
app.alert('FAIL: ' + expression + ' = ' + actual + ', expected to throw');
|
|
} catch (e) {
|
|
app.alert('PASS: ' + expression + ' threw ' + e);
|
|
}
|
|
}
|