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

Side by Side Diff: tests/language/src/NullTest.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 // Second dart test program.
5
6 class NullTest {
7 static int foo(var obj) {
8 Expect.equals(null, obj);
9 }
10
11 static bool compareToNull(var value) {
12 return null == value;
13 }
14
15 static bool compareWithNull(var value) {
16 return value == null;
17 }
18
19 static int testMain() {
20 var val = 1;
21 var obj = null;
22
23 Expect.equals(null, obj);
24 Expect.equals(null, null);
25
26 foo(obj);
27 foo(null);
28
29 if (obj != null) {
30 foo(null);
31 } else {
32 foo(obj);
33 }
34
35 Expect.isFalse(compareToNull(val));
36 Expect.isTrue(compareToNull(obj));
37 Expect.isFalse(compareWithNull(val));
38 Expect.isTrue(compareWithNull(obj));
39 Expect.isTrue(obj is Object);
40 Expect.isFalse(obj is String);
41 Expect.isTrue(obj is !String);
42 Expect.isFalse(obj is !Object);
43 Expect.isFalse(val is !Object);
44
45 return 0;
46 }
47 }
48
49
50 main() {
51 NullTest.testMain();
52 }
OLDNEW
« no previous file with comments | « tests/language/src/NullPointerExceptionTest.dart ('k') | tests/language/src/NullToStringTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698