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

Side by Side Diff: tests/compiler/dart2js/metadata_test.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 80chars. Created 8 years, 1 month 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
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 import "dart:uri"; 5 import "dart:uri";
6 6
7 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 import 'parser_helper.dart'; 8 import 'parser_helper.dart';
9 9
10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t'; 10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t';
(...skipping 26 matching lines...) Expand all
37 $declaration 37 $declaration
38 main() {}"""; 38 main() {}""";
39 39
40 compileAndCheck(source, name, (compiler, element) { 40 compileAndCheck(source, name, (compiler, element) {
41 compiler.enqueuer.resolution.queueIsClosed = false; 41 compiler.enqueuer.resolution.queueIsClosed = false;
42 Expect.equals(2, length(element.metadata)); 42 Expect.equals(2, length(element.metadata));
43 MetadataAnnotation annotation1 = element.metadata.head; 43 MetadataAnnotation annotation1 = element.metadata.head;
44 MetadataAnnotation annotation2 = element.metadata.tail.head; 44 MetadataAnnotation annotation2 = element.metadata.tail.head;
45 annotation1.ensureResolved(compiler); 45 annotation1.ensureResolved(compiler);
46 annotation2.ensureResolved(compiler); 46 annotation2.ensureResolved(compiler);
47 Expect.isTrue(annotation1 !== annotation2, 'expected unique instances'); 47 Expect.isTrue(!identical(annotation1, annotation2), 'expected unique instanc es');
Lasse Reichstein Nielsen 2012/11/12 13:10:41 isFalse and remove the '!'. And long line.
floitsch 2012/11/12 22:18:43 Done.
48 Expect.notEquals(annotation1, annotation2, 'expected unequal instances'); 48 Expect.notEquals(annotation1, annotation2, 'expected unequal instances');
49 Constant value1 = annotation1.value; 49 Constant value1 = annotation1.value;
50 Constant value2 = annotation2.value; 50 Constant value2 = annotation2.value;
51 Expect.identical(value1, value2, 'expected same compile-time constant'); 51 Expect.identical(value1, value2, 'expected same compile-time constant');
52 Expect.stringEquals('xyz', value1.value.slowToString()); 52 Expect.stringEquals('xyz', value1.value.slowToString());
53 Expect.stringEquals('xyz', value2.value.slowToString()); 53 Expect.stringEquals('xyz', value2.value.slowToString());
54 }); 54 });
55 55
56 if (isTopLevelOnly) return; 56 if (isTopLevelOnly) return;
57 57
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 compiler.enqueuer.resolution.queueIsClosed = false; 90 compiler.enqueuer.resolution.queueIsClosed = false;
91 Expect.equals(0, length(element.metadata)); 91 Expect.equals(0, length(element.metadata));
92 element.ensureResolved(compiler); 92 element.ensureResolved(compiler);
93 Expect.equals(0, length(element.metadata)); 93 Expect.equals(0, length(element.metadata));
94 element = element.lookupLocalMember(buildSourceString(name)); 94 element = element.lookupLocalMember(buildSourceString(name));
95 Expect.equals(2, length(element.metadata)); 95 Expect.equals(2, length(element.metadata));
96 MetadataAnnotation annotation1 = element.metadata.head; 96 MetadataAnnotation annotation1 = element.metadata.head;
97 MetadataAnnotation annotation2 = element.metadata.tail.head; 97 MetadataAnnotation annotation2 = element.metadata.tail.head;
98 annotation1.ensureResolved(compiler); 98 annotation1.ensureResolved(compiler);
99 annotation2.ensureResolved(compiler); 99 annotation2.ensureResolved(compiler);
100 Expect.isTrue(annotation1 !== annotation2, 'expected unique instances'); 100 Expect.isTrue(!identical(annotation1, annotation2), 'expected unique instanc es');
Lasse Reichstein Nielsen 2012/11/12 13:10:41 Ditto.
floitsch 2012/11/12 22:18:43 Done.
101 Expect.notEquals(annotation1, annotation2, 'expected unequal instances'); 101 Expect.notEquals(annotation1, annotation2, 'expected unequal instances');
102 Constant value1 = annotation1.value; 102 Constant value1 = annotation1.value;
103 Constant value2 = annotation2.value; 103 Constant value2 = annotation2.value;
104 Expect.identical(value1, value2, 'expected same compile-time constant'); 104 Expect.identical(value1, value2, 'expected same compile-time constant');
105 Expect.stringEquals('xyz', value1.value.slowToString()); 105 Expect.stringEquals('xyz', value1.value.slowToString());
106 Expect.stringEquals('xyz', value2.value.slowToString()); 106 Expect.stringEquals('xyz', value2.value.slowToString());
107 }); 107 });
108 } 108 }
109 109
110 void testClassMetadata() { 110 void testClassMetadata() {
111 checkAnnotation('Foo', 'class Foo {}', isTopLevelOnly: true); 111 checkAnnotation('Foo', 'class Foo {}', isTopLevelOnly: true);
112 } 112 }
113 113
114 void testTopLevelMethodMetadata() { 114 void testTopLevelMethodMetadata() {
115 checkAnnotation('foo', 'foo() {}'); 115 checkAnnotation('foo', 'foo() {}');
116 } 116 }
117 117
118 void testTopLevelFieldMetadata() { 118 void testTopLevelFieldMetadata() {
119 checkAnnotation('foo', 'var foo;'); 119 checkAnnotation('foo', 'var foo;');
120 } 120 }
121 121
122 void main() { 122 void main() {
123 testClassMetadata(); 123 testClassMetadata();
124 testTopLevelMethodMetadata(); 124 testTopLevelMethodMetadata();
125 testTopLevelFieldMetadata(); 125 testTopLevelFieldMetadata();
126 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698