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

Unified Diff: tests/language/equality_test.dart

Issue 10855208: Implement new equality spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: tests/language/equality_test.dart
===================================================================
--- tests/language/equality_test.dart (revision 0)
+++ tests/language/equality_test.dart (revision 0)
@@ -0,0 +1,29 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+
+class A {
+ bool _result;
+ A(this._result);
+ operator ==(x) { return _result; }
+}
+
+tests() {
+ var alwaysTrue = new A(true);
+ var alwaysFalse = new A(false);
+ Expect.isFalse(alwaysFalse == alwaysFalse);
+ Expect.isTrue(alwaysFalse != alwaysFalse);
+ Expect.isTrue(alwaysTrue == alwaysTrue);
+ Expect.isTrue(alwaysTrue == 5);
+ Expect.isFalse(alwaysTrue == null);
+ Expect.isFalse(null == alwaysTrue);
+ Expect.isTrue(alwaysTrue != null);
+ Expect.isTrue(null != alwaysTrue);
+ Expect.isTrue(null == null);
+ Expect.isFalse(null != null);
sra1 2012/08/17 01:34:08 Should also compare cases where both sides are exp
+}
+
+main() {
+ for (int i = 0; i < 1000; i++) tests();
+}
« runtime/vm/intermediate_language_x64.cc ('K') | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698