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

Unified Diff: tests/language/runtime_type2_test.dart

Issue 1213033002: Fix runtimeType.toString for tear-offs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Improved test. Created 5 years, 6 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 | « sdk/lib/_internal/js_runtime/lib/js_helper.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/runtime_type2_test.dart
diff --git a/tests/language/runtime_type2_test.dart b/tests/language/runtime_type2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bdd062974b1eb10c480a2ccd898a042ab96e2f33
--- /dev/null
+++ b/tests/language/runtime_type2_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2015, 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.
+
+import "package:expect/expect.dart";
+
+class A {
+ foo() => 499;
+}
+
+bar() => 42;
+
+main() {
+ String runtimeStringFoo = new A().foo.runtimeType.toString();
+ String runtimeStringBar = bar.runtimeType.toString();
+ // Check for the VM string, the unminified dart2js string, and a short
+ // string (in case it was minified).
+ Expect.isTrue(
+ runtimeStringFoo == "() => dynamic" ||
+ runtimeStringFoo == "BoundClosure" ||
+ new RegExp('[a-zA-Z]{1,3}').hasMatch(runtimeStringFoo));
+ Expect.isTrue(
+ runtimeStringBar == "() => dynamic" ||
+ runtimeStringBar == "StaticClosure" ||
+ new RegExp('[a-zA-Z]{1,3}').hasMatch(runtimeStringFoo));
+}
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698