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

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

Issue 2625053003: VM: [Kernel] Add toString() support for generated enum classes (Closed)
Patch Set: use old Expect.identical() Created 3 years, 11 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
« no previous file with comments | « tests/co19/co19-kernel.status ('k') | tests/language/language.status » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 enum Enum1 { _ } 7 enum Enum1 { _ }
8 enum Enum2 { A } 8 enum Enum2 { A }
9 enum Enum3 { B, C } 9 enum Enum3 { B, C }
10 enum Enum4 { D, E, } 10 enum Enum4 { D, E, }
11 enum Enum5 { F, G, H } 11 enum Enum5 { F, G, H }
12 enum _Enum6 { I, _J } 12 enum _Enum6 { I, _J }
13 13
14 main() { 14 main() {
15 Expect.equals('Enum1._', Enum1._.toString()); 15 Expect.equals('Enum1._', Enum1._.toString());
16 Expect.equals(0, Enum1._.index); 16 Expect.equals(0, Enum1._.index);
17 Expect.listEquals([Enum1._], Enum1.values); 17 Expect.listEquals([Enum1._], Enum1.values);
18 Enum1.values.forEach(test1); 18 Enum1.values.forEach(test1);
19 19
20 Expect.equals('Enum2.A', Enum2.A.toString()); 20 Expect.equals('Enum2.A', Enum2.A.toString());
21 Expect.equals(0, Enum2.A.index); 21 Expect.equals(0, Enum2.A.index);
22 Expect.listEquals([Enum2.A], Enum2.values); 22 Expect.listEquals([Enum2.A], Enum2.values);
23 Expect.identical(const [Enum2.A], Enum2.values); 23 Expect.identical(const <Enum2>[Enum2.A], Enum2.values);
24 Enum2.values.forEach(test2); 24 Enum2.values.forEach(test2);
25 25
26 Expect.equals('Enum3.B', Enum3.B.toString()); 26 Expect.equals('Enum3.B', Enum3.B.toString());
27 Expect.equals('Enum3.C', Enum3.C.toString()); 27 Expect.equals('Enum3.C', Enum3.C.toString());
28 Expect.equals(0, Enum3.B.index); 28 Expect.equals(0, Enum3.B.index);
29 Expect.equals(1, Enum3.C.index); 29 Expect.equals(1, Enum3.C.index);
30 Expect.listEquals([Enum3.B, Enum3.C], Enum3.values); 30 Expect.listEquals([Enum3.B, Enum3.C], Enum3.values);
31 Enum3.values.forEach(test3); 31 Enum3.values.forEach(test3);
32 32
33 Expect.equals('Enum4.D', Enum4.D.toString()); 33 Expect.equals('Enum4.D', Enum4.D.toString());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 break; 104 break;
105 case Enum5.F: 105 case Enum5.F:
106 index = 0; 106 index = 0;
107 break; 107 break;
108 case Enum5.G: 108 case Enum5.G:
109 index = 1; 109 index = 1;
110 break; 110 break;
111 } 111 }
112 Expect.equals(e.index, index); 112 Expect.equals(e.index, index);
113 } 113 }
OLDNEW
« no previous file with comments | « tests/co19/co19-kernel.status ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698