Commit 719712b7 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Add test for AppContext (#7465)

parent 8f708bfb
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter_tools/src/base/context.dart' hide context;
import 'package:flutter_tools/src/base/context.dart' as pkg;
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/globals.dart';
import 'package:test/test.dart';
......@@ -76,5 +77,26 @@ void main() {
});
});
});
test('overriddenValuesInNestedZones', () async {
expect(pkg.context, isNull);
AppContext outerContext = new AppContext();
outerContext.setVariable(String, 'outer');
outerContext.runInZone(() async {
expect(pkg.context[String], 'outer');
AppContext middleContext = new AppContext();
middleContext.setVariable(String, 'middle');
middleContext.runInZone(() async {
expect(pkg.context[String], 'middle');
AppContext innerContext = new AppContext();
innerContext.setVariable(String, 'inner');
innerContext.runInZone(() async {
expect(pkg.context[String], 'inner');
});
expect(pkg.context[String], 'middle');
});
expect(pkg.context[String], 'outer');
});
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment