diff options
Diffstat (limited to 'Libraries/LibJS/Tests/variable-declaration.js')
-rw-r--r-- | Libraries/LibJS/Tests/variable-declaration.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Libraries/LibJS/Tests/variable-declaration.js b/Libraries/LibJS/Tests/variable-declaration.js index b1231925db..258b8dbd1a 100644 --- a/Libraries/LibJS/Tests/variable-declaration.js +++ b/Libraries/LibJS/Tests/variable-declaration.js @@ -3,14 +3,13 @@ load("test-common.js"); try { const constantValue = 1; - try { + assertThrowsError(() => { constantValue = 2; - assertNotReached(); - } catch (e) { - assert(e.name === "TypeError"); - assert(e.message === "Assignment to constant variable"); - assert(constantValue === 1); - } + }, { + error: TypeError, + message: "Assignment to constant variable" + }); + assert(constantValue === 1); // Make sure we can define new constants in inner scopes. const constantValue2 = 1; |