diff --git a/.github/workflows/very_good_cli.yaml b/.github/workflows/very_good_cli.yaml index 91289066..1973fe1f 100644 --- a/.github/workflows/very_good_cli.yaml +++ b/.github/workflows/very_good_cli.yaml @@ -10,7 +10,10 @@ on: jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v5 diff --git a/test/src/command_runner_test.dart b/test/src/command_runner_test.dart index da9d82da..7e49f8fd 100644 --- a/test/src/command_runner_test.dart +++ b/test/src/command_runner_test.dart @@ -194,8 +194,10 @@ void main() { stdout = _MockStdout(); when(() => stdout.hasTerminal).thenReturn(true); - when(() => stdout.supportsAnsiEscapes).thenReturn(true); + when(() => stdout.terminalColumns).thenReturn(30); + + when(() => stdout.supportsAnsiEscapes).thenReturn(true); }); test('shows message when version changed', () async { @@ -269,6 +271,32 @@ void main() { ); }); + test('fallback to HOME when XDG_CONFIG_HOME is null/empty', () async { + commandRunner + ..environmentOverride = { + 'HOME': '/users/test', + 'XDG_CONFIG_HOME': '', + } + ..isWindowsOverride = false; + + final homeCache = _MockDirectory(); + when(() => homeCache.path).thenReturn('/users/test'); + + await IOOverrides.runZoned( + () async { + final result = await commandRunner.run([]); + expect(result, equals(ExitCode.success.code)); + + verifyNever(() => cliCache.path); + verify(() => homeCache.path).called(1); + }, + createDirectory: (path) => + path.contains('test') ? homeCache : cliCache, + createFile: (path) => versionFile, + stdout: () => stdout, + ); + }); + test('cache inside local APP_DATA on windows', () async { commandRunner ..environmentOverride = {'LOCALAPPDATA': '/C/Users/test'}