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

Unified Diff: runtime/observatory/tests/service/contexts_test.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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: runtime/observatory/tests/service/contexts_test.dart
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index d93b0f142ceeb173c6b2fc3c8fa0f2bf59b9b478..d6c7f895166c9fb59b072bb5b516fab3f3ef9e01 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -23,20 +23,21 @@ Function genCopyingBlock() {
}
Function genFullBlock() {
- var x = 42; // I must captured in a context.
+ var x = 42; // I must captured in a context.
block() => x;
x++;
return block;
}
Function genFullBlockWithChain() {
- var x = 420; // I must captured in a context.
+ var x = 420; // I must captured in a context.
outerBlock() {
var y = 4200;
innerBlock() => x + y;
y++;
return innerBlock;
}
+
x++;
return outerBlock();
}
@@ -49,94 +50,90 @@ void script() {
}
var tests = [
-
-(Isolate isolate) =>
- isolate.rootLibrary.load().then((Library lib) {
- Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
- return field.load().then((_) {
- return field.staticValue.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(0));
- return block.closureContext.load().then((Context ctxt) {
- expect(ctxt.parentContext, isNull);
+ (Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
+ Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.closureContext.isContext, isTrue);
+ expect(block.closureContext.length, equals(0));
+ return block.closureContext.load().then((Context ctxt) {
+ expect(ctxt.parentContext, isNull);
+ });
+ });
});
- });
- });
- }),
-
-(Isolate isolate) =>
- isolate.rootLibrary.load().then((Library lib) {
- Field field = lib.variables.singleWhere((v) => v.name == 'copyingBlock');
- return field.load().then((_) {
- return field.staticValue.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- return block.closureContext.load().then((Context ctxt) {
- expect(ctxt.variables.single.value.asValue.isString, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString,
- equals('I could be copied into the block'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext, isNull);
+ }),
+ (Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
+ Field field =
+ lib.variables.singleWhere((v) => v.name == 'copyingBlock');
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.closureContext.isContext, isTrue);
+ expect(block.closureContext.length, equals(1));
+ return block.closureContext.load().then((Context ctxt) {
+ expect(ctxt.variables.single.value.asValue.isString, isTrue);
+ expect(ctxt.variables.single.value.asValue.valueAsString,
+ equals('I could be copied into the block'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(0));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.parentContext, isNull);
+ });
+ });
});
});
- });
- });
- }),
-
-(Isolate isolate) =>
- isolate.rootLibrary.load().then((Library lib) {
- Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
- return field.load().then((_) {
- return field.staticValue.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- return block.closureContext.load().then((Context ctxt) {
- expect(ctxt.variables.single.value.asValue.isInt, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString, equals('43'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext, isNull);
+ }),
+ (Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
+ Field field = lib.variables.singleWhere((v) => v.name == 'fullBlock');
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.closureContext.isContext, isTrue);
+ expect(block.closureContext.length, equals(1));
+ return block.closureContext.load().then((Context ctxt) {
+ expect(ctxt.variables.single.value.asValue.isInt, isTrue);
+ expect(ctxt.variables.single.value.asValue.valueAsString,
+ equals('43'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(0));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.parentContext, isNull);
+ });
+ });
});
});
- });
- });
- }),
-
-(Isolate isolate) =>
- isolate.rootLibrary.load().then((Library lib) {
- Field field = lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain');
- return field.load().then((_) {
- return field.staticValue.load().then((Instance block) {
- expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(1));
- return block.closureContext.load().then((Context ctxt) {
- expect(ctxt.variables.single.value.asValue.isInt, isTrue);
- expect(ctxt.variables.single.value.asValue.valueAsString,
- equals('4201'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(1));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.variables.single.value.asValue.isInt, isTrue);
- expect(outerCtxt.variables.single.value.asValue.valueAsString,
- equals('421'));
- expect(outerCtxt.parentContext.isContext, isTrue);
- expect(outerCtxt.parentContext.length, equals(0));
- return outerCtxt.parentContext.load().then((Context outerCtxt2) {
- expect(outerCtxt2.parentContext, isNull);
+ }),
+ (Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
+ Field field =
+ lib.variables.singleWhere((v) => v.name == 'fullBlockWithChain');
+ return field.load().then((_) {
+ return field.staticValue.load().then((Instance block) {
+ expect(block.isClosure, isTrue);
+ expect(block.closureContext.isContext, isTrue);
+ expect(block.closureContext.length, equals(1));
+ return block.closureContext.load().then((Context ctxt) {
+ expect(ctxt.variables.single.value.asValue.isInt, isTrue);
+ expect(ctxt.variables.single.value.asValue.valueAsString,
+ equals('4201'));
+ expect(ctxt.parentContext.isContext, isTrue);
+ expect(ctxt.parentContext.length, equals(1));
+ return ctxt.parentContext.load().then((Context outerCtxt) {
+ expect(outerCtxt.variables.single.value.asValue.isInt, isTrue);
+ expect(outerCtxt.variables.single.value.asValue.valueAsString,
+ equals('421'));
+ expect(outerCtxt.parentContext.isContext, isTrue);
+ expect(outerCtxt.parentContext.length, equals(0));
+ return outerCtxt.parentContext
+ .load()
+ .then((Context outerCtxt2) {
+ expect(outerCtxt2.parentContext, isNull);
+ });
+ });
});
});
});
- });
- });
- }),
-
+ }),
];
main(args) => runIsolateTests(args, tests, testeeBefore: script);
« no previous file with comments | « runtime/observatory/tests/service/complex_reload_test.dart ('k') | runtime/observatory/tests/service/crash_dump_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698