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

Unified Diff: dart/tests/lib/mirrors/library_metadata_test.dart

Issue 17241002: Reuse existing test instead of duplicating code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/lib/mirrors/library_metadata_test.dart
diff --git a/dart/tests/lib/mirrors/library_metadata_test.dart b/dart/tests/lib/mirrors/library_metadata_test.dart
index 3ae8b11d101dd063b44d8961d952b84a507c7980..259e398b1756302666d60a2e14ffc28975447d10 100644
--- a/dart/tests/lib/mirrors/library_metadata_test.dart
+++ b/dart/tests/lib/mirrors/library_metadata_test.dart
@@ -7,39 +7,10 @@ library test.library_metadata_test;
import 'dart:mirrors';
-const string = 'a metadata string';
-
-const symbol = const Symbol('symbol');
-
-const hest = 'hest';
-
-checkMetadata(DeclarationMirror mirror, List expectedMetadata) {
- List metadata = mirror.metadata.map((m) => m.reflectee).toList();
- if (metadata == null) {
- throw 'Null metadata on $mirror';
- }
- int expectedLength = expectedMetadata.length;
- int actualLength = metadata.length;
- if (expectedLength != actualLength) {
- throw 'Expected length = $expectedLength, but got length = $actualLength.';
- }
- for (int i = 0; i < expectedLength; i++) {
- if (metadata[i] != expectedMetadata[i]) {
- throw '${metadata[i]} is not "${expectedMetadata[i]}"'
- ' in $mirror at index $i';
- }
- }
- print(metadata);
-}
+import 'metadata_test.dart';
main() {
- if (MirrorSystem.getName(symbol) != 'symbol') {
- // This happened in dart2js due to how early library metadata is
- // computed.
- throw 'Bad constant: $symbol';
- }
-
MirrorSystem mirrors = currentMirrorSystem();
checkMetadata(mirrors.findLibrary(const Symbol('test.library_metadata_test')).first,
- [string, symbol]);
+ [string, symbol]);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698