Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: tests/language/stacktrace_demangle_ctors_test.dart

Issue 2823253005: Fix #28740 demangle constructors in stack traces (A.A becomes new A) REDO (Closed)
Patch Set: Don't recurse in QualifiedName, just check the ending function kind for ctor Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..697ed127675e7b14d033f37c877f5ed1ed77dd97
--- /dev/null
+++ b/tests/language/stacktrace_demangle_ctors_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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 stack traces are properly demangled in constructors (#28740).
+
+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"));
+ }
+}
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698