Index: tests/compiler/dart2js/metadata_test.dart |
diff --git a/tests/compiler/dart2js/metadata_test.dart b/tests/compiler/dart2js/metadata_test.dart |
index 9255a755a0b0ddf3191afaa4d0c41f8c3ac4a86c..ef2994ca194effd62e751f638f5eb60bf7b6a7e7 100644 |
--- a/tests/compiler/dart2js/metadata_test.dart |
+++ b/tests/compiler/dart2js/metadata_test.dart |
@@ -3,24 +3,21 @@ |
// BSD-style license that can be found in the LICENSE file. |
import 'package:async_helper/async_helper.dart'; |
-import 'package:compiler/src/constants/values.dart' |
- show PrimitiveConstantValue; |
+import 'package:compiler/src/constants/values.dart' show PrimitiveConstantValue; |
import 'package:expect/expect.dart'; |
import 'compiler_helper.dart'; |
-import 'package:compiler/src/parser/partial_elements.dart' show |
- PartialMetadataAnnotation; |
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart' show |
- DiagnosticReporter; |
- |
-void checkPosition(Spannable spannable, |
- Node node, |
- String source, |
- DiagnosticReporter reporter) { |
+import 'package:compiler/src/parser/partial_elements.dart' |
+ show PartialMetadataAnnotation; |
+import 'package:compiler/src/diagnostics/diagnostic_listener.dart' |
+ show DiagnosticReporter; |
+ |
+void checkPosition(Spannable spannable, Node node, String source, |
+ DiagnosticReporter reporter) { |
SourceSpan span = reporter.spanFromSpannable(spannable); |
- Expect.isTrue(span.begin < span.end, |
- 'begin = ${span.begin}; end = ${span.end}'); |
- Expect.isTrue(span.end < source.length, |
- 'end = ${span.end}; length = ${source.length}'); |
+ Expect.isTrue( |
+ span.begin < span.end, 'begin = ${span.begin}; end = ${span.end}'); |
+ Expect.isTrue( |
+ span.end < source.length, 'end = ${span.end}; length = ${source.length}'); |
String yield = source.substring(span.begin, span.end); |
// TODO(ahe): The node does not include "@". Fix that. |
@@ -28,7 +25,7 @@ void checkPosition(Spannable spannable, |
} |
void checkAnnotation(String name, String declaration, |
- {bool isTopLevelOnly: false}) { |
+ {bool isTopLevelOnly: false}) { |
// Ensure that a compile-time constant can be resolved from an |
// annotation. |
var source1 = """const native = 'xyz'; |
@@ -38,8 +35,8 @@ void checkAnnotation(String name, String declaration, |
compileAndCheck(source1, name, (compiler, element) { |
compiler.enqueuer.resolution.queueIsClosed = false; |
- Expect.equals(1, element.metadata.length, |
- 'Unexpected metadata count on $element.'); |
+ Expect.equals( |
+ 1, element.metadata.length, 'Unexpected metadata count on $element.'); |
PartialMetadataAnnotation annotation = element.metadata.first; |
annotation.ensureResolved(compiler.resolution); |
PrimitiveConstantValue value = |
@@ -64,8 +61,8 @@ void checkAnnotation(String name, String declaration, |
PartialMetadataAnnotation annotation2 = element.metadata.elementAt(1); |
annotation1.ensureResolved(compiler.resolution); |
annotation2.ensureResolved(compiler.resolution); |
- Expect.isFalse(identical(annotation1, annotation2), |
- 'expected unique instances'); |
+ Expect.isFalse( |
+ identical(annotation1, annotation2), 'expected unique instances'); |
Expect.notEquals(annotation1, annotation2, 'expected unequal instances'); |
PrimitiveConstantValue value1 = |
compiler.constants.getConstantValue(annotation1.constant); |
@@ -129,8 +126,8 @@ void checkAnnotation(String name, String declaration, |
PartialMetadataAnnotation annotation2 = element.metadata.elementAt(1); |
annotation1.ensureResolved(compiler.resolution); |
annotation2.ensureResolved(compiler.resolution); |
- Expect.isFalse(identical(annotation1, annotation2), |
- 'expected unique instances'); |
+ Expect.isFalse( |
+ identical(annotation1, annotation2), 'expected unique instances'); |
Expect.notEquals(annotation1, annotation2, 'expected unequal instances'); |
PrimitiveConstantValue value1 = |
compiler.constants.getConstantValue(annotation1.constant); |
@@ -161,8 +158,7 @@ void testTopLevelFieldMetadata() { |
} |
void testLibraryTags() { |
- void compileAndCheckLibrary( |
- String source, |
+ void compileAndCheckLibrary(String source, |
List<MetadataAnnotation> extractMetadata(LibraryElement element)) { |
Uri partUri = new Uri(scheme: 'source', path: 'part.dart'); |
String partSource = '@native part of foo;'; |
@@ -173,26 +169,26 @@ void testLibraryTags() { |
Uri uri = new Uri(scheme: 'source', path: 'main.dart'); |
var compiler = compilerFor(source, uri) |
- ..registerSource(partUri, partSource) |
- ..registerSource(libUri, libSource); |
+ ..registerSource(partUri, partSource) |
+ ..registerSource(libUri, libSource); |
asyncTest(() => compiler.run(uri).then((_) { |
- compiler.enqueuer.resolution.queueIsClosed = false; |
- LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); |
- Expect.isNotNull(element, 'Cannot find $uri'); |
- |
- List<MetadataAnnotation> metadata = extractMetadata(element); |
- Expect.equals(1, metadata.length); |
- |
- PartialMetadataAnnotation annotation = metadata.first; |
- annotation.ensureResolved(compiler.resolution); |
- PrimitiveConstantValue value = |
- compiler.constants.getConstantValue(annotation.constant); |
- Expect.stringEquals('xyz', value.primitiveValue.slowToString()); |
- |
- checkPosition( |
- annotation, annotation.cachedNode, source, compiler.reporter); |
- })); |
+ compiler.enqueuer.resolution.queueIsClosed = false; |
+ LibraryElement element = compiler.libraryLoader.lookupLibrary(uri); |
+ Expect.isNotNull(element, 'Cannot find $uri'); |
+ |
+ List<MetadataAnnotation> metadata = extractMetadata(element); |
+ Expect.equals(1, metadata.length); |
+ |
+ PartialMetadataAnnotation annotation = metadata.first; |
+ annotation.ensureResolved(compiler.resolution); |
+ PrimitiveConstantValue value = |
+ compiler.constants.getConstantValue(annotation.constant); |
+ Expect.stringEquals('xyz', value.primitiveValue.slowToString()); |
+ |
+ checkPosition( |
+ annotation, annotation.cachedNode, source, compiler.reporter); |
+ })); |
} |
var source; |
@@ -225,8 +221,8 @@ void testLibraryTags() { |
part 'part.dart'; |
const native = 'xyz'; |
main() {}"""; |
- compileAndCheckLibrary(source, |
- (e) => e.compilationUnits.first.partTag.metadata); |
+ compileAndCheckLibrary( |
+ source, (e) => e.compilationUnits.first.partTag.metadata); |
} |
void main() { |