From 29ed6f8ef066a289027f0b08a577d51341f4fdd3 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 10 Oct 2023 20:16:31 +0200 Subject: [PATCH] test/system: Keep empty lines to prevent missing and spurious newlines https://github.com/containers/toolbox/pull/1386 --- test/system/002-help.bats | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/test/system/002-help.bats b/test/system/002-help.bats index 2a0d9c3..4c47651 100644 --- a/test/system/002-help.bats +++ b/test/system/002-help.bats @@ -24,14 +24,14 @@ setup() { } @test "help: Try to run toolbox with no command" { - run "$TOOLBOX" + run --keep-empty-lines "$TOOLBOX" assert_failure assert_line --index 0 "Error: missing command" - assert_line --index 1 "create Create a new toolbox container" - assert_line --index 2 "enter Enter an existing toolbox container" - assert_line --index 3 "list List all existing toolbox containers and images" - assert_line --index 4 "Run 'toolbox --help' for usage." + assert_line --index 2 "create Create a new toolbox container" + assert_line --index 3 "enter Enter an existing toolbox container" + assert_line --index 4 "list List all existing toolbox containers and images" + assert_line --index 6 "Run 'toolbox --help' for usage." } @test "help: Run command 'help'" { @@ -39,7 +39,7 @@ setup() { skip "Test works only if man is in PATH" fi - run "$TOOLBOX" help + run --keep-empty-lines "$TOOLBOX" help assert_success assert_line --index 0 --partial "toolbox(1)" @@ -51,26 +51,26 @@ setup() { skip "Test works only if man is not in PATH" fi - run "$TOOLBOX" help + run --keep-empty-lines "$TOOLBOX" help assert_success assert_line --index 0 "toolbox - Tool for containerized command line environments on Linux" - assert_line --index 1 "Common commands are:" - assert_line --index 2 "create Create a new toolbox container" - assert_line --index 3 "enter Enter an existing toolbox container" - assert_line --index 4 "list List all existing toolbox containers and images" - assert_line --index 5 "Go to https://github.com/containers/toolbox for further information." + assert_line --index 2 "Common commands are:" + assert_line --index 3 "create Create a new toolbox container" + assert_line --index 4 "enter Enter an existing toolbox container" + assert_line --index 5 "list List all existing toolbox containers and images" + assert_line --index 7 "Go to https://github.com/containers/toolbox for further information." } @test "help: Use flag '--help' (it should show usage screen)" { - run "$TOOLBOX" --help + run --keep-empty-lines "$TOOLBOX" --help assert_success assert_output --partial "toolbox - Tool for containerized command line environments on Linux" } @test "help: Try to run toolbox with non-existent command (shows usage screen)" { - run "$TOOLBOX" foo + run --keep-empty-lines "$TOOLBOX" foo assert_failure assert_line --index 0 "Error: unknown command \"foo\" for \"toolbox\"" @@ -78,7 +78,7 @@ setup() { } @test "help: Try to run toolbox with non-existent flag (shows usage screen)" { - run "$TOOLBOX" --foo + run --keep-empty-lines "$TOOLBOX" --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -86,7 +86,7 @@ setup() { } @test "help: Try to run 'toolbox create' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" create --foo + run --keep-empty-lines "$TOOLBOX" create --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -94,7 +94,7 @@ setup() { } @test "help: Try to run 'toolbox enter' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" enter --foo + run --keep-empty-lines "$TOOLBOX" enter --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -102,7 +102,7 @@ setup() { } @test "help: Try to run 'toolbox help' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" help --foo + run --keep-empty-lines "$TOOLBOX" help --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -110,7 +110,7 @@ setup() { } @test "help: Try to run 'toolbox init-container' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" init-container --foo + run --keep-empty-lines "$TOOLBOX" init-container --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -118,7 +118,7 @@ setup() { } @test "help: Try to run 'toolbox list' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" list --foo + run --keep-empty-lines "$TOOLBOX" list --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -126,7 +126,7 @@ setup() { } @test "help: Try to run 'toolbox rm' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" rm --foo + run --keep-empty-lines "$TOOLBOX" rm --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -134,7 +134,7 @@ setup() { } @test "help: Try to run 'toolbox rmi' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" rmi --foo + run --keep-empty-lines "$TOOLBOX" rmi --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo" @@ -142,7 +142,7 @@ setup() { } @test "help: Try to run 'toolbox run' with non-existent flag (shows usage screen)" { - run "$TOOLBOX" run --foo + run --keep-empty-lines "$TOOLBOX" run --foo assert_failure assert_line --index 0 "Error: unknown flag: --foo"