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

Unified Diff: pkg/analyzer2dart/test/sexpr_test.dart

Issue 867233004: Support constructor declarations in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 years, 11 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 | « pkg/analyzer2dart/test/sexpr_data.dart ('k') | pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/test/sexpr_test.dart
diff --git a/pkg/analyzer2dart/test/sexpr_test.dart b/pkg/analyzer2dart/test/sexpr_test.dart
index 9a1790d41181f7cdb2da06b4858113545102bb49..e4f83eeb38b94888dee5c43073c5bc17b0f046dd 100644
--- a/pkg/analyzer2dart/test/sexpr_test.dart
+++ b/pkg/analyzer2dart/test/sexpr_test.dart
@@ -38,28 +38,40 @@ checkResult(TestSpec result) {
ClosedWorld world = driver.computeWorld(entryPoint);
ConvertedWorld convertedWorld = convertWorld(world);
- void checkOutput(dart2js.Element element, String expectedOutput) {
+ void checkOutput(String elementName,
+ dart2js.Element element,
+ String expectedOutput) {
expectedOutput = expectedOutput.trim();
String output = convertedWorld.getIr(element)
.accept(new SExpressionStringifier());
expect(output, equals(expectedOutput),
- reason: 'Input:\n$input\n'
- 'Expected:\n$expectedOutput\n'
- 'Actual:\n$output');
+ reason: "\nInput:\n${result.input}\n"
+ "Expected for '$elementName':\n$expectedOutput\n"
+ "Actual for '$elementName':\n$output\n");
}
if (result.output is String) {
- checkOutput(convertedWorld.mainFunction, result.output);
+ checkOutput('main', convertedWorld.mainFunction, result.output);
} else {
assert(result.output is Map<String, String>);
dart2js.LibraryElement mainLibrary = convertedWorld.mainFunction.library;
result.output.forEach((String elementName, String output) {
+ bool found = false;
+ List<String> names = <String>[];
convertedWorld.resolvedElements.forEach((dart2js.Element element) {
- if (element.name == elementName &&
- element.library == mainLibrary) {
- checkOutput(element, output);
+ if (element.library == mainLibrary) {
+ String name = element.name;
+ if (element.enclosingClass != null) {
+ name = '${element.enclosingClass.name}.$name';
+ }
+ if (name == elementName) {
+ checkOutput(elementName, element, output);
+ found = true;
+ }
+ names.add(name);
}
});
+ expect(found, isTrue, reason: "'$elementName' not found in $names.");
});
}
}
« no previous file with comments | « pkg/analyzer2dart/test/sexpr_data.dart ('k') | pkg/compiler/lib/src/cps_ir/shrinking_reductions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698