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

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

Issue 10697068: Change dart2js to follow the new spec on the equality operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
« no previous file with comments | « tests/co19/co19-leg.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 class A { 5 class A {
6 operator ==(other) => 1; 6 operator ==(other) => 1;
7 operator <(other) => null; 7 operator <(other) => null;
8 operator <=(other) => 499; 8 operator <=(other) => 499;
9 operator >(other) => "foo"; 9 operator >(other) => "foo";
10 operator >=(other) => 42; 10 operator >=(other) => 42;
11 } 11 }
12 12
13 // This triggered a bug in Dart2Js: equality operator was always boolified. 13 // This triggered a bug in Dart2Js: equality operator was always boolified.
14 equals(a) { 14 equals(a) {
15 try { 15 try {
16 Expect.equals(1, a == a); 16 Expect.equals(1, a == a);
17 } catch(TypeError e) { 17 } catch(TypeError e) {
18 // In checked mode the test doesn't do anything. 18 // In checked mode the test doesn't do anything.
19 } 19 }
20 } 20 }
21 21
22 equalsNull(a) { 22 equalsNull(a) {
23 try { 23 try {
24 Expect.equals(1, a == null); 24 Expect.equals(false, a == null);
25 } catch(TypeError e) { 25 } catch(TypeError e) {
26 // In checked mode the test doesn't do anything. 26 // In checked mode the test doesn't do anything.
27 } 27 }
28 } 28 }
29 29
30 less(a) { 30 less(a) {
31 try { 31 try {
32 Expect.equals(null, a < a); 32 Expect.equals(null, a < a);
33 } catch(TypeError e) {} 33 } catch(TypeError e) {}
34 } 34 }
(...skipping 12 matching lines...) Expand all
47 47
48 greaterEqual(a) { 48 greaterEqual(a) {
49 try { 49 try {
50 Expect.equals(42, a >= a); 50 Expect.equals(42, a >= a);
51 } catch(TypeError e) {} 51 } catch(TypeError e) {}
52 } 52 }
53 53
54 main() { 54 main() {
55 var a = new A(); 55 var a = new A();
56 equals(a); 56 equals(a);
57 equalsNull(a);
floitsch 2012/07/03 13:35:29 hehe.
57 less(a); 58 less(a);
58 lessEqual(a); 59 lessEqual(a);
59 greater(a); 60 greater(a);
60 greaterEqual(a); 61 greaterEqual(a);
61 } 62 }
OLDNEW
« no previous file with comments | « tests/co19/co19-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698