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

Side by Side Diff: tests/standalone/assert_test.dart

Issue 2984363004: Migrate first block of tests in standalone to standalone_2 (Closed)
Patch Set: Remove Expect.throws Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--enable_asserts
5
6 // Dart test program testing assert statements.
7
8 import "package:expect/expect.dart";
9
10 class AssertTest {
11 static test() {
12 try {
13 assert(false);
14 Expect.fail("Assertion 'false' didn't fail.");
15 } on AssertionError catch (error) {
16 Expect.isTrue(error.toString().contains("'false'"));
17 Expect.isTrue(
18 error.stackTrace.toString().contains("assert_test.dart:13:14"));
19 }
20 }
21
22 static testClosure() {
23 try {
24 assert(() => false);
25 Expect.fail("Assertion '() => false' didn't fail.");
26 } on AssertionError catch (error) {
27 Expect.isTrue(error.toString().contains("'() => false'"));
28 Expect.isTrue(
29 error.stackTrace.toString().contains("assert_test.dart:24:14"));
30 }
31 }
32
33 static testMain() {
34 test();
35 testClosure();
36 }
37 }
38
39 main() {
40 AssertTest.testMain();
41 }
OLDNEW
« no previous file with comments | « tests/standalone/assert_assignable_canon_test.dart ('k') | tests/standalone/byte_array_view_optimized_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698