// Not a flutter test, a plain dart program: // // dart run test/core_headless.dart // // It imports core and nothing else and runs on the standalone vm, which has // no dart:ui. If core ever picked up a flutter import this wouldnt compile. import "dart:io"; import "package:garage_updates/core.dart"; Future main() async { final engine = UpdateEngine.detect(project: "proj_headless", build: 1); // `dart run` is the jit, so this is a dev copy and the engine must sit still if (engine.installed) { stderr.writeln("FAIL: a dart run was taken for an install"); exit(1); } engine.reportIfNotInstalled(); final info = await engine.check(); if (info.status != UpdateStatus.unknown) { stderr.writeln("FAIL: an engine with no install asked the server"); exit(1); } final state = StateFile(File("${Directory.systemTemp.path}/garage_updates_headless_missing.json")); if (state.read() != null) { stderr.writeln("FAIL: a missing state file read as something"); exit(1); } engine.close(); print("core runs headless: supported=$kUpdatesSupported arch=${currentUpdateArch()} platform=${currentUpdatePlatform()}"); }