Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // This tests uses the multi-test "ok" feature: | 5 // This tests uses the multi-test "ok" feature: |
| 6 // none: Trimmed behaviour. Passing on the VM. | 6 // none: Trimmed behaviour. Passing on the VM. |
| 7 // 01: Trimmed version for dart2js. | 7 // 01: Trimmed version for dart2js. |
| 8 // 02: Full version passing in the VM. | 8 // 02: Full version passing in the VM. |
| 9 // | 9 // |
| 10 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. | 10 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 } | 25 } |
| 26 | 26 |
| 27 typedef bool Predicate(Object o); | 27 typedef bool Predicate(Object o); |
| 28 Predicate somePredicate; | 28 Predicate somePredicate; |
| 29 | 29 |
| 30 checkEquality(List<Map> equivalenceClasses) { | 30 checkEquality(List<Map> equivalenceClasses) { |
| 31 for (var equivalenceClass in equivalenceClasses) { | 31 for (var equivalenceClass in equivalenceClasses) { |
| 32 equivalenceClass.forEach((name, member) { | 32 equivalenceClass.forEach((name, member) { |
| 33 equivalenceClass.forEach((otherName, otherMember) { | 33 equivalenceClass.forEach((otherName, otherMember) { |
| 34 // Reflexivity, symmetry and transitivity. | 34 // Reflexivity, symmetry and transitivity. |
| 35 Expect.equals(member, | 35 Expect.equals(member, |
| 36 otherMember, | 36 otherMember, |
| 37 "$name == $otherName"); | 37 "$name == $otherName"); |
| 38 Expect.equals(member.hashCode, | 38 Expect.equals(member.hashCode, |
| 39 otherMember.hashCode, | 39 otherMember.hashCode, |
| 40 "$name.hashCode == $otherName.hashCode"); | 40 "$name.hashCode == $otherName.hashCode"); |
| 41 }); | 41 }); |
| 42 for (var otherEquivalenceClass in equivalenceClasses) { | 42 for (var otherEquivalenceClass in equivalenceClasses) { |
| 43 if (otherEquivalenceClass == equivalenceClass) continue; | 43 if (otherEquivalenceClass == equivalenceClass) continue; |
| 44 otherEquivalenceClass.forEach((otherName, otherMember) { | 44 otherEquivalenceClass.forEach((otherName, otherMember) { |
| 45 Expect.notEquals(member, | 45 Expect.notEquals(member, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 | 105 |
| 106 {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType, | 106 {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType, |
| 107 'thisLibrary.declarations[#main].returnType' : | 107 'thisLibrary.declarations[#main].returnType' : |
| 108 (thisLibrary.declarations[#main] as MethodMirror).returnType}, | 108 (thisLibrary.declarations[#main] as MethodMirror).returnType}, |
| 109 | 109 |
| 110 {'reflectClass(A)' : reflectClass(A), | 110 {'reflectClass(A)' : reflectClass(A), |
| 111 'thisLibrary.declarations[#A]' : thisLibrary.declarations[#A], | 111 'thisLibrary.declarations[#A]' : thisLibrary.declarations[#A], |
| 112 'reflect(new A<int>()).type.originalDeclaration' : | 112 'reflect(new A<int>()).type.originalDeclaration' : |
| 113 reflect(new A<int>()).type.originalDeclaration}, | 113 reflect(new A<int>()).type.originalDeclaration}, |
| 114 | 114 |
| 115 {'reflectClass(B).superclass' : reflectClass(B).superclass, /// 02: ok | 115 {'reflectClass(B).superclass' : reflectClass(B).superclass, |
| 116 'reflect(new A<int>()).type' : reflect(new A<int>()).type}, /// 02: ok | 116 'reflect(new A<int>()).type' : reflect(new A<int>()).type}, |
| 117 | 117 |
| 118 {'reflectClass(B)' : reflectClass(B), | 118 {'reflectClass(B)' : reflectClass(B), |
| 119 'thisLibrary.declarations[#B]' : thisLibrary.declarations[#B], | 119 'thisLibrary.declarations[#B]' : thisLibrary.declarations[#B], |
| 120 'reflect(new B()).type' : reflect(new B()).type}, | 120 'reflect(new B()).type' : reflect(new B()).type}, |
| 121 | 121 |
| 122 {'reflectClass(BadEqualityHash).declarations[#==]' /// 02: ok | 122 {'reflectClass(BadEqualityHash).declarations[#==]' |
| 123 : reflectClass(BadEqualityHash).declarations[#==], /// 02: ok | 123 : reflectClass(BadEqualityHash).declarations[#==], |
| 124 'reflect(new BadEqualityHash()).type.declarations[#==]' /// 02: ok | 124 'reflect(new BadEqualityHash()).type.declarations[#==]' |
| 125 : reflect(new BadEqualityHash()).type.declarations[#==]}, /// 02: ok | 125 : reflect(new BadEqualityHash()).type.declarations[#==]}, |
| 126 | 126 |
| 127 {'reflectClass(BadEqualityHash).declarations[#==].parameters[0]' /// 02: ok | 127 {'reflectClass(BadEqualityHash).declarations[#==].parameters[0]' |
| 128 : (reflectClass(BadEqualityHash).declarations[#==] as MethodMirror).para meters[0], /// 02: ok | 128 : (reflectClass(BadEqualityHash).declarations[#==] as MethodMirror).para meters[0], |
|
Johnni Winther
2013/11/25 07:19:20
Long line.
zarah
2013/12/19 10:53:34
Done.
| |
| 129 'reflect(new BadEqualityHash()).type.declarations[#==].parameters[0]' /// 02: ok | 129 'reflect(new BadEqualityHash()).type.declarations[#==].parameters[0]' |
| 130 : (reflect(new BadEqualityHash()).type.declarations[#==] as MethodMirror ).parameters[0]}, /// 02: ok | 130 : (reflect(new BadEqualityHash()).type.declarations[#==] as MethodMirror ).parameters[0]}, |
|
Johnni Winther
2013/11/25 07:19:20
Long line.
zarah
2013/12/19 10:53:34
Done.
| |
| 131 | 131 |
| 132 {'reflectClass(BadEqualityHash).declarations[#count]' /// 02: ok | 132 {'reflectClass(BadEqualityHash).declarations[#count]' |
| 133 : reflectClass(BadEqualityHash).declarations[#count], /// 02: ok | 133 : reflectClass(BadEqualityHash).declarations[#count], |
| 134 'reflect(new BadEqualityHash()).type.declarations[#count]' /// 02: ok | 134 'reflect(new BadEqualityHash()).type.declarations[#count]' |
| 135 : reflect(new BadEqualityHash()).type.declarations[#count]}, /// 02: ok | 135 : reflect(new BadEqualityHash()).type.declarations[#count]}, |
| 136 | 136 |
| 137 {'reflectType(Predicate)' : reflectType(Predicate), /// 02: ok | 137 {'reflectType(Predicate)' : reflectType(Predicate), /// 02: ok |
| 138 'thisLibrary.declarations[#somePredicate].type' /// 02: ok | 138 'thisLibrary.declarations[#somePredicate].type' /// 02: ok |
| 139 : (thisLibrary.declarations[#somePredicate] as VariableMirror).type}, / // 02: ok | 139 : (thisLibrary.declarations[#somePredicate] as VariableMirror).type}, / // 02: ok |
| 140 | 140 |
| 141 {'reflectType(Predicate).referent' : (reflectType(Predicate) as TypedefMirro r).referent, /// 02: ok | 141 {'reflectType(Predicate).referent' : (reflectType(Predicate) as TypedefMirro r).referent, /// 02: ok |
| 142 'thisLibrary.declarations[#somePredicate].type.referent' /// 02: ok | 142 'thisLibrary.declarations[#somePredicate].type.referent' /// 02: ok |
| 143 : ((thisLibrary.declarations[#somePredicate] as VariableMirror).type as TypedefMirror).referent}, /// 02: ok | 143 : ((thisLibrary.declarations[#somePredicate] as VariableMirror).type as TypedefMirror).referent}, /// 02: ok |
| 144 | 144 |
| 145 {'reflectClass(A).typeVariables.single' /// 02: ok | 145 {'reflectClass(A).typeVariables.single' |
| 146 : reflectClass(A).typeVariables.single, /// 02: ok | 146 : reflectClass(A).typeVariables.single, |
| 147 'reflect(new A<int>()).type.originalDeclaration.typeVariables.single' /// 02: ok | 147 'reflect(new A<int>()).type.originalDeclaration.typeVariables.single' |
| 148 : reflect(new A<int>()).type.originalDeclaration.typeVariables.single}, /// 02: ok | 148 : reflect(new A<int>()).type.originalDeclaration.typeVariables.single}, |
| 149 | 149 |
| 150 {'currentMirrorSystem()' : currentMirrorSystem()}, | 150 {'currentMirrorSystem()' : currentMirrorSystem()}, |
| 151 | 151 |
| 152 {'currentMirrorSystem().isolate' : currentMirrorSystem().isolate}, | 152 {'currentMirrorSystem().isolate' : currentMirrorSystem().isolate}, |
| 153 | 153 |
| 154 {'thisLibrary' : thisLibrary, | 154 {'thisLibrary' : thisLibrary, |
| 155 'reflectClass(A).owner' : reflectClass(A).owner, | 155 'reflectClass(A).owner' : reflectClass(A).owner, |
| 156 'reflectClass(B).owner' : reflectClass(B).owner, | 156 'reflectClass(B).owner' : reflectClass(B).owner, |
| 157 'reflect(new A()).type.owner' : reflect(new A()).type.owner, | 157 'reflect(new A()).type.owner' : reflect(new A()).type.owner, |
| 158 'reflect(new B()).type.owner' : reflect(new B()).type.owner}, | 158 'reflect(new B()).type.owner' : reflect(new B()).type.owner}, |
| 159 ]); | 159 ]); |
| 160 } | 160 } |
| OLD | NEW |