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

Side by Side Diff: tests/language/strict_equal_test.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 main() { 6 main() {
7 for (int i = 0; i < 6000; i++) { 7 for (int i = 0; i < 6000; i++) {
8 Expect.isFalse(test1(5)); 8 Expect.isFalse(test1(5));
9 Expect.isTrue(test1(3)); 9 Expect.isTrue(test1(3));
10 10
(...skipping 25 matching lines...) Expand all
36 Expect.isFalse(test10r(0)); 36 Expect.isFalse(test10r(0));
37 Expect.isTrue(test10(2)); 37 Expect.isTrue(test10(2));
38 Expect.isTrue(test10r(2)); 38 Expect.isTrue(test10r(2));
39 39
40 test11(i); 40 test11(i);
41 } 41 }
42 } 42 }
43 43
44 44
45 test1(a) { 45 test1(a) {
46 return a === 3; 46 return identical(a, 3);
47 } 47 }
48 48
49 test2(a) { 49 test2(a) {
50 return a !== 3; 50 return !identical(a, 3);
51 } 51 }
52 52
53 53
54 test2r(a) { 54 test2r(a) {
55 return 3 !== a; 55 return !identical(3, a);
56 } 56 }
57 57
58 58
59 test3() { 59 test3() {
60 return get5() === 5; 60 return identical(get5(), 5);
61 } 61 }
62 62
63 63
64 test4(a) { 64 test4(a) {
65 if (a === 3) { 65 if (identical(a, 3)) {
66 return 1; 66 return 1;
67 } else { 67 } else {
68 return 2; 68 return 2;
69 } 69 }
70 } 70 }
71 71
72 72
73 test5(a) { 73 test5(a) {
74 if (a !== 3) { 74 if (!identical(a, 3)) {
75 return 1; 75 return 1;
76 } else { 76 } else {
77 return 2; 77 return 2;
78 } 78 }
79 } 79 }
80 80
81 81
82 test6() { 82 test6() {
83 if (get5() === 5) { 83 if (identical(get5(), 5)) {
84 return 1; 84 return 1;
85 } else { 85 } else {
86 return 2; 86 return 2;
87 } 87 }
88 } 88 }
89 89
90 get5() { 90 get5() {
91 return 5; 91 return 5;
92 } 92 }
93 93
94 test7() { 94 test7() {
95 return null !== null; 95 return null != null;
96 } 96 }
97 97
98 98
99 test8() { 99 test8() {
100 if (null !== null) { 100 if (null != null) {
101 return 1; 101 return 1;
102 } else { 102 } else {
103 return 2; 103 return 2;
104 } 104 }
105 } 105 }
106 106
107 107
108 test9(a) { 108 test9(a) {
109 return a === 0; 109 return identical(a, 0);
110 } 110 }
111 111
112 112
113 test9r(a) { 113 test9r(a) {
114 return 0 === a; 114 return identical(0, a);
115 } 115 }
116 116
117 117
118 test10(a) { 118 test10(a) {
119 return a !== 0; 119 return !identical(a, 0);
120 } 120 }
121 121
122 test10r(a) { 122 test10r(a) {
123 return 0 !== a; 123 return !identical(0, a);
124 } 124 }
125 125
126 test11(a) { 126 test11(a) {
127 if (a === 0) { 127 if (identical(a, 0)) {
128 Expect.isTrue(0 === a); 128 Expect.isTrue(identical(0, a));
129 Expect.isFalse(a !== 0); 129 Expect.isFalse(!identical(a, 0));
130 Expect.isFalse(0 !== a); 130 Expect.isFalse(!identical(0, a));
131 } else { 131 } else {
132 Expect.isFalse(0 === a); 132 Expect.isFalse(identical(0, a));
133 Expect.isTrue(a !== 0); 133 Expect.isTrue(!identical(a, 0));
134 Expect.isTrue(0 !== a); 134 Expect.isTrue(!identical(0, a));
135 } 135 }
136 } 136 }
OLDNEW
« no previous file with comments | « tests/language/static_const_field_test.dart ('k') | tests/standalone/io/echo_server_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698