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

Side by Side Diff: tests/lib_strong/mirrors/enum_test.dart

Issue 3011633002: Added back helper file accidentally deleted during test block 219 migration. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « tests/lib_strong/mirrors/empty_test.dart ('k') | tests/lib_strong/mirrors/equality_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 library test.enums;
6
7 import 'dart:mirrors';
8 import 'package:expect/expect.dart';
9 import 'stringify.dart';
10
11 class C {}
12
13 enum Suite { CLUBS, DIAMONDS, SPADES, HEARTS }
14
15 main() {
16 Expect.isFalse(reflectClass(C).isEnum);
17
18 Expect.isTrue(reflectClass(Suite).isEnum);
19 Expect.isFalse(reflectClass(Suite).isAbstract);
20 Expect.equals(
21 0,
22 reflectClass(Suite)
23 .declarations
24 .values
25 .where((d) => d is MethodMirror && d.isConstructor)
26 .length);
27
28 Expect.equals(
29 reflectClass(Suite),
30 (reflectClass(C).owner as LibraryMirror).declarations[#Suite],
31 "found in library");
32
33 Expect.equals(reflectClass(Suite), reflect(Suite.CLUBS).type);
34
35 Expect.equals(0, reflect(Suite.CLUBS).getField(#index).reflectee);
36 Expect.equals(1, reflect(Suite.DIAMONDS).getField(#index).reflectee);
37 Expect.equals(2, reflect(Suite.SPADES).getField(#index).reflectee);
38 Expect.equals(3, reflect(Suite.HEARTS).getField(#index).reflectee);
39
40 Expect.equals(
41 "Suite.CLUBS", reflect(Suite.CLUBS).invoke(#toString, []).reflectee);
42 Expect.equals("Suite.DIAMONDS",
43 reflect(Suite.DIAMONDS).invoke(#toString, []).reflectee);
44 Expect.equals(
45 "Suite.SPADES", reflect(Suite.SPADES).invoke(#toString, []).reflectee);
46 Expect.equals(
47 "Suite.HEARTS", reflect(Suite.HEARTS).invoke(#toString, []).reflectee);
48
49 Expect.setEquals(
50 [
51 'Variable(s(index) in s(Suite), final)',
52 'Variable(s(CLUBS) in s(Suite), static, final)',
53 'Variable(s(DIAMONDS) in s(Suite), static, final)',
54 'Variable(s(SPADES) in s(Suite), static, final)',
55 'Variable(s(HEARTS) in s(Suite), static, final)',
56 'Variable(s(values) in s(Suite), static, final)',
57 'Method(s(hashCode) in s(Suite), getter)',
58 'Method(s(toString) in s(Suite))'
59 ],
60 reflectClass(Suite)
61 .declarations
62 .values
63 .where((d) => !d.isPrivate)
64 .map(stringify));
65 }
OLDNEW
« no previous file with comments | « tests/lib_strong/mirrors/empty_test.dart ('k') | tests/lib_strong/mirrors/equality_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698