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

Side by Side Diff: tests/lib/mirrors/class_equality_test.dart

Issue 23657002: Ensure class mirrors on non-generic classes always have their runtime type set. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« runtime/lib/mirrors_impl.dart ('K') | « tests/lib/lib.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
(Empty)
1 // Copyright (c) 2013, 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.class_equality_test;
6
7 import 'dart:mirrors';
8
9 import 'package:expect/expect.dart';
10
11 class A<T> {}
12 class B extends A<int> {}
13
14 main() {
15 LibraryMirror thisLibrary =
16 currentMirrorSystem()
17 .findLibrary(const Symbol('test.class_equality_test'))
18 .single;
19
20 ClassMirror A_declaration = reflectClass(A);
21 ClassMirror A_instantiated_with_int = reflectClass(B).superclass;
22 ClassMirror A_from_library = thisLibrary.classes[const Symbol('A')];
23 ClassMirror A_from_instance = reflect(new A<int>()).type;
24
25 // Test for symmetry!
26 Expect.notEquals(A_declaration, A_instantiated_with_int);
27 Expect.notEquals(A_instantiated_with_int, A_declaration);
28
29 Expect.equals(A_declaration, A_from_library);
30 Expect.equals(A_from_library, A_declaration);
31
32 Expect.notEquals(A_from_library, A_instantiated_with_int);
33 Expect.notEquals(A_instantiated_with_int, A_from_library);
34
35 Expect.equals(A_from_instance, A_instantiated_with_int);
36 Expect.equals(A_instantiated_with_int, A_from_instance);
37
38 Expect.notEquals(A_declaration, A_from_instance);
39 Expect.notEquals(A_from_instance, A_declaration);
40
41 Expect.notEquals(A_from_library, A_from_instance);
42 Expect.notEquals(A_from_instance, A_from_library);
43
44
45 ClassMirror B_declaration = reflectClass(B);
46 ClassMirror B_from_library = thisLibrary.classes[const Symbol('B')];
47 ClassMirror B_from_instance = reflect(new B()).type;
48
49 Expect.equals(B_declaration, B_from_library);
50 Expect.equals(B_from_library, B_declaration);
51
52 Expect.equals(B_from_instance, B_from_library);
53 Expect.equals(B_from_library, B_from_instance);
54
55 Expect.equals(B_declaration, B_from_instance);
56 Expect.equals(B_from_instance, B_declaration);
57 }
OLDNEW
« runtime/lib/mirrors_impl.dart ('K') | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698