(t *testing.T)
| 316 | } |
| 317 | |
| 318 | func TestVersionCommandFunctionality(t *testing.T) { |
| 319 | t.Run("version information is available", func(t *testing.T) { |
| 320 | // The cli package should provide version functionality |
| 321 | versionInfo := cli.GetVersion() |
| 322 | assert.NotEmpty(t, versionInfo, "GetVersion should return version information") |
| 323 | }) |
| 324 | |
| 325 | t.Run("--version flag is supported", func(t *testing.T) { |
| 326 | // Test that --version flag works |
| 327 | cmd := exec.Command("go", "run", ".", "--version") |
| 328 | cmd.Dir = "." |
| 329 | |
| 330 | output, err := cmd.CombinedOutput() |
| 331 | require.NoError(t, err, "running main with --version should succeed") |
| 332 | |
| 333 | outputStr := string(output) |
| 334 | // Should produce version output |
| 335 | assert.NotEmpty(t, strings.TrimSpace(outputStr), "--version flag should produce output") |
| 336 | |
| 337 | // Should contain "version" in the output |
| 338 | assert.Contains(t, outputStr, "version", "--version output should contain the word 'version'") |
| 339 | }) |
| 340 | |
| 341 | t.Run("version subcommand and --version flag produce same output", func(t *testing.T) { |
| 342 | // Test version subcommand |
| 343 | cmdVersion := exec.Command("go", "run", ".", "version") |
| 344 | cmdVersion.Dir = "." |
| 345 | outputVersion, err := cmdVersion.CombinedOutput() |
| 346 | require.NoError(t, err, "running main with version subcommand should succeed") |
| 347 | |
| 348 | // Test --version flag |
| 349 | cmdFlag := exec.Command("go", "run", ".", "--version") |
| 350 | cmdFlag.Dir = "." |
| 351 | outputFlag, err := cmdFlag.CombinedOutput() |
| 352 | require.NoError(t, err, "running main with --version flag should succeed") |
| 353 | |
| 354 | // Both should produce the same output |
| 355 | assert.Equal(t, string(outputVersion), string(outputFlag), "version subcommand and --version flag should produce identical output") |
| 356 | }) |
| 357 | } |
| 358 | |
| 359 | func TestCommandLineIntegration(t *testing.T) { |
| 360 | // Test basic command line parsing and validation |
nothing calls this directly
no test coverage detected