diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/optional-catch-binding.js')
-rw-r--r-- | deps/v8/test/mjsunit/harmony/optional-catch-binding.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/harmony/optional-catch-binding.js b/deps/v8/test/mjsunit/harmony/optional-catch-binding.js new file mode 100644 index 0000000000..093288c4e6 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/optional-catch-binding.js @@ -0,0 +1,39 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-optional-catch-binding + +let state = 'initial'; +try { + throw new Error('caught'); + state = 'unreachable'; +} catch { // Note the lack of a binding + assertEquals(state, 'initial'); + state = 'caught'; +} +assertEquals(state, 'caught'); + + +let sigil1 = {}; +try { + throw sigil1; +} catch (e) { + assertEquals(e, sigil1); +} + + +let sigil2 = {}; +let reached = false; +try { + try { + throw sigil1; + } catch { + reached = true; + } finally { + throw sigil2; + } +} catch (e) { + assertEquals(e, sigil2); +} +assertTrue(reached); |