Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, 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 | |
| 5 | |
| 6 class A { | |
| 7 bool _result; | |
| 8 A(this._result); | |
| 9 operator ==(x) { return _result; } | |
| 10 } | |
| 11 | |
| 12 tests() { | |
| 13 var alwaysTrue = new A(true); | |
| 14 var alwaysFalse = new A(false); | |
| 15 Expect.isFalse(alwaysFalse == alwaysFalse); | |
| 16 Expect.isTrue(alwaysFalse != alwaysFalse); | |
| 17 Expect.isTrue(alwaysTrue == alwaysTrue); | |
| 18 Expect.isTrue(alwaysTrue == 5); | |
| 19 Expect.isFalse(alwaysTrue == null); | |
| 20 Expect.isFalse(null == alwaysTrue); | |
| 21 Expect.isTrue(alwaysTrue != null); | |
| 22 Expect.isTrue(null != alwaysTrue); | |
| 23 Expect.isTrue(null == null); | |
| 24 Expect.isFalse(null != null); | |
|
sra1
2012/08/17 01:34:08
Should also compare cases where both sides are exp
| |
| 25 } | |
| 26 | |
| 27 main() { | |
| 28 for (int i = 0; i < 1000; i++) tests(); | |
| 29 } | |
| OLD | NEW |