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

Side by Side Diff: tests/language/src/AssertionTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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_type_checks
5 //
6 // Dart test program testing assert statements.
7
8 class AssertionTest {
9 static testTrue() {
10 int i = 0;
11 try {
12 assert(true);
13 } catch (AssertionError error) {
14 i = 1;
15 }
16 return i;
17 }
18
19 static testFalse() {
20 int i = 0;
21 try {
22 assert(false);
23 } catch (AssertionError error) {
24 i = 1;
25 }
26 return i;
27 }
28
29 static unknown(var a) {
30 return (a) ? true : false;
31 }
32
33 static testUnknown() {
34 var x = unknown(false);
35 int i = 0;
36 try {
37 assert(x);
38 } catch (AssertionError error) {
39 i = 1;
40 }
41 return i;
42 }
43
44 static testClosure() {
45 int i = 0;
46 try {
47 assert(() => false);
48 } catch (AssertionError error) {
49 i = 1;
50 }
51 return i;
52 }
53
54 static testClosure2() {
55 int i = 0;
56 try {
57 var x = () => false;
58 assert(x);
59 } catch (AssertionError error) {
60 i = 1;
61 }
62 return i;
63 }
64
65 static testMain() {
66 Expect.equals(0, testTrue());
67 Expect.equals(1, testFalse());
68 Expect.equals(1, testClosure());
69 Expect.equals(1, testClosure2());
70 }
71 }
72
73 main() {
74 AssertionTest.testMain();
75 }
OLDNEW
« no previous file with comments | « tests/language/src/AssertKeywordNegativeTest.dart ('k') | tests/language/src/AssignInstanceMethodNegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698