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

Unified Diff: tests/compiler/dart2js/js_backend_cps_ir.dart

Issue 1571953002: cps_ir: add refinement on "success" arguments for a set of whitelisted methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
Index: tests/compiler/dart2js/js_backend_cps_ir.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir.dart b/tests/compiler/dart2js/js_backend_cps_ir.dart
index b5f395aa44cc2ce50f3438ce8123debd7eaf5bf3..d33fab45a44c19bf7b29ec4146e7cc34d70e841b 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir.dart
@@ -64,6 +64,8 @@ runTests(List<TestEntry> tests) {
Map files = {TEST_MAIN_FILE: test.source};
asyncTest(() async {
Uri uri = Uri.parse('memory:$TEST_MAIN_FILE');
+ String expected = test.expectation;
+ String found = null;
try {
CompilationResult result = await runCompiler(
entryPoint: uri,
@@ -71,15 +73,10 @@ runTests(List<TestEntry> tests) {
options: <String>['--use-cps-ir']);
Expect.isTrue(result.isSuccess);
CompilerImpl compiler = result.compiler;
- String expectation = test.expectation;
- if (expectation != null) {
- String expected = test.expectation;
- String found = test.elementName == null
+ if (expected != null) {
+ found = test.elementName == null
? getCodeForMain(compiler)
: getCodeForMethod(compiler, test.elementName);
- if (expected != found) {
- Expect.fail('Expected:\n$expected\nbut found\n$found');
- }
}
} catch (e, st) {
print(e);
@@ -87,6 +84,12 @@ runTests(List<TestEntry> tests) {
Expect.fail('The following test failed to compile:\n'
'${formatTest(files)}');
}
+ if (expected != found) {
+ Expect.fail('Unexpected output for test:\n '
+ '${formatTest(files).replaceAll('\n', '\n ')}\n'
+ 'Expected:\n ${expected.replaceAll('\n', '\n ')}\n'
+ 'but found:\n ${found?.replaceAll('\n', '\n ')}');
+ }
});
}
}

Powered by Google App Engine
This is Rietveld 408576698