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

Unified Diff: tests/standalone/assert_test.dart

Issue 21832003: Fix VM implementation of CastError not to extend TypeError (issue 5280). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/lib/analyzer/analyze_tests.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/assert_test.dart
===================================================================
--- tests/standalone/assert_test.dart (revision 25781)
+++ tests/standalone/assert_test.dart (working copy)
@@ -2,7 +2,9 @@
// 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.
// VMOptions=--enable_asserts
+
// Dart test program testing assert statements.
+
import "package:expect/expect.dart";
class AssertTest {
@@ -11,15 +13,9 @@
assert(false);
Expect.fail("Assertion 'false' didn't fail.");
} on AssertionError catch (error) {
- Expect.equals("false", error.failedAssertion);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("assert_test.dart", subs);
- Expect.equals(11, error.line);
- Expect.equals(14, error.column);
+ Expect.isTrue(error.toString().contains("'false'"));
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "assert_test.dart:13:14"));
}
}
static testClosure() {
@@ -27,15 +23,9 @@
assert(() => false);
Expect.fail("Assertion '() => false' didn't fail.");
} on AssertionError catch (error) {
- Expect.equals("() => false", error.failedAssertion);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("assert_test.dart", subs);
- Expect.equals(27, error.line);
- Expect.equals(14, error.column);
+ Expect.isTrue(error.toString().contains("'() => false'"));
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "assert_test.dart:23:14"));
}
}
« no previous file with comments | « tests/lib/analyzer/analyze_tests.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698