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

Unified Diff: tests/language/strict_equal_test.dart

Issue 10984051: More compact code for strict compare with 0. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/strict_equal_test.dart
===================================================================
--- tests/language/strict_equal_test.dart (revision 12926)
+++ tests/language/strict_equal_test.dart (working copy)
@@ -26,6 +26,18 @@
Expect.isFalse(test7());
Expect.equals(2, test8());
+
+ Expect.isFalse(test9(2));
+ Expect.isFalse(test9r(2));
+ Expect.isTrue(test9(0));
+ Expect.isTrue(test9r(0));
+
+ Expect.isFalse(test10(0));
+ Expect.isFalse(test10r(0));
+ Expect.isTrue(test10(2));
+ Expect.isTrue(test10r(2));
+
+ test11(i);
}
}
@@ -91,3 +103,34 @@
return 2;
}
}
+
+
+test9(a) {
+ return a === 0;
+}
+
+
+test9r(a) {
+ return 0 === a;
+}
+
+
+test10(a) {
+ return a !== 0;
+}
+
+test10r(a) {
+ return 0 !== a;
+}
+
+test11(a) {
+ if (a === 0) {
+ Expect.isTrue(0 === a);
+ Expect.isFalse(a !== 0);
+ Expect.isFalse(0 !== a);
+ } else {
+ Expect.isFalse(0 === a);
+ Expect.isTrue(a !== 0);
+ Expect.isTrue(0 !== a);
+ }
+}
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698