33 lines
1.2 KiB
Dart
33 lines
1.2 KiB
Dart
import 'package:oto/oto/application.dart';
|
|
import 'package:oto/oto/core/execution_context.dart';
|
|
import 'package:oto/oto/core/tag_system.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
setUp(() {
|
|
Application.instance.context = ExecutionContext();
|
|
});
|
|
|
|
test('context backs application compatibility accessors', () {
|
|
Application.instance.property['workspace'] = '/tmp/oto';
|
|
Application.instance.commandStates['step'] = CommandState.progress;
|
|
|
|
expect(Application.instance.context.property['workspace'], '/tmp/oto');
|
|
expect(
|
|
Application.instance.context.commandStates['step'], CommandState.progress);
|
|
|
|
Application.instance.context.property['key'] = 'value';
|
|
expect(Application.instance.property['key'], 'value');
|
|
});
|
|
|
|
test('tag system reads and writes through execution context', () async {
|
|
await TagSystem.setPropertyValue('<@property.appVersion>', '1.2.3',
|
|
showPrint: false);
|
|
|
|
expect(Application.instance.context.property['appVersion'], '1.2.3');
|
|
expect(TagSystem.replaceTagValue('<!property.appVersion>'), '1.2.3');
|
|
|
|
Application.instance.context.commandStates['build'] = CommandState.complete;
|
|
expect(TagSystem.replaceTagValue('<!state.build>'), 'complete');
|
|
});
|
|
}
|