diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/try/completion-values.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/try/completion-values.js')
-rw-r--r-- | js/src/tests/test262/language/statements/try/completion-values.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/try/completion-values.js b/js/src/tests/test262/language/statements/try/completion-values.js new file mode 100644 index 0000000000..2959b82189 --- /dev/null +++ b/js/src/tests/test262/language/statements/try/completion-values.js @@ -0,0 +1,67 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-try-statement-runtime-semantics-evaluation +description: > + Direct eval try/catch/finally for completion value +info: | + TryStatement : try Block Catch Finally + + Let B be the result of evaluating Block. + If B.[[Type]] is throw, let C be CatchClauseEvaluation of Catch with argument B.[[Value]]. + Else, let C be B. + Let F be the result of evaluating Finally. + If F.[[Type]] is normal, set F to C. + Return Completion(UpdateEmpty(F, undefined)). +---*/ + +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -2 }; } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -2 }; } while (false);'), + undefined +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; } while (false);'), + undefined +); +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; break; -3 }; -77 } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; break; -3 }; -77 } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { break; -3 }; -77 } while (false);'), + undefined +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { break; -3 }; -77 } while (false);'), + undefined +); +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1; } finally { 42; continue; -3 }; } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { 39 } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'), + 42 +); +assert.sameValue( + eval('99; do { -99; try { [].x.x } catch (e) { -1 } finally { 42; continue; -3 }; -77 } while (false);'), + 42 +); + +reportCompare(0, 0); |