I have written a simple command-line Dart app. The functionality of the app is in file app.dart located in the bin directory.
bin/app.dart
import 'dart:io';
void main(List<String> args) {
//(...)
}
I'd like to test the main method with unit tests. For this purpose I have a file app_test.dart in the test directory
test/app_test.dart
import 'package:test/test.dart';
import 'package:app/app.dart';
void main() {
test('main method runs through with exit code 0', () {
//I'd like to run the main method from bin/app.dart here
});
}
How can I refer to the main method in bin/app.dart from the file test/app.dart to run the main method for testing?