Chromium Code Reviews| Index: tests/language/stacktrace_demangle_ctors_test.dart |
| diff --git a/tests/language/stacktrace_demangle_ctors_test.dart b/tests/language/stacktrace_demangle_ctors_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..21dca05b5ffc2accf2b9d407d84760deb637cda4 |
| --- /dev/null |
| +++ b/tests/language/stacktrace_demangle_ctors_test.dart |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
|
siva
2017/04/15 01:05:59
2017
|
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +// Test that a stack trace is properly terminated (issue 8850). |
|
siva
2017/04/15 01:05:59
The comment here does not seem to match the intend
|
| + |
| +import "package:expect/expect.dart"; |
| + |
| +class SomeClass { |
| + SomeClass.namedConstructor() { |
| + throw new Exception(); |
| + } |
| + |
| + SomeClass() { |
| + throw new Exception(); |
| + } |
| + |
| + factory SomeClass.useFactory() { |
| + throw new Exception(); |
| + } |
| +} |
| + |
| +class OnlyHasFactory { |
| + factory OnlyHasFactory() { |
| + throw new Exception(); |
| + } |
| +} |
| + |
| +void main() { |
| + try { |
| + new SomeClass(); |
| + } on Exception catch (e, st) { |
| + final stString = st.toString(); |
| + Expect.isTrue(stString.contains("new SomeClass")); |
| + Expect.isFalse(stString.contains("SomeClass.")); |
| + } |
| + |
| + try { |
| + new SomeClass.namedConstructor(); |
| + } on Exception catch (e, st) { |
| + final stString = st.toString(); |
| + Expect.isTrue(stString.contains("new SomeClass.namedConstructor")); |
| + } |
| + |
| + try { |
| + new OnlyHasFactory(); |
| + } on Exception catch (e, st) { |
| + final stString = st.toString(); |
| + Expect.isTrue(stString.contains("new OnlyHasFactory")); |
| + Expect.isFalse(stString.contains("OnlyHasFactory.")); |
| + } |
| + |
| + try { |
| + new SomeClass.useFactory(); |
| + } on Exception catch (e, st) { |
| + final stString = st.toString(); |
| + Expect.isTrue(stString.contains("new SomeClass.useFactory")); |
| + } |
| +} |