Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove exit code from test that fail #183

Open
khru opened this issue Oct 13, 2023 · 0 comments
Open

Remove exit code from test that fail #183

khru opened this issue Oct 13, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@khru
Copy link
Member

khru commented Oct 13, 2023

I've implemented an acceptance test over bashunit and my test failed because I needed it to know the exit code of the test and added to my output, even when this information was not relevant.

function test_bashunit_should_allow_test_drive_development() {
  local test_file=./tests/acceptance/fake_error_test.sh
  fixture=$(printf "Running ./tests/acceptance/fake_error_test.sh
\e[31m✗ Failed\e[0m: Error tdd with error code 127

\e[2mTests:     \e[0m \e[31m1 failed\e[0m, 1 total
\e[2mAssertions:\e[0m \e[31m0 failed\e[0m, 0 total")

  echo "
  #!/bin/bash
  function test_error_tdd() { assert_that_will_never_exist \"1\" \"1\" ; }" > $test_file

  set +e

  assertContains "$fixture" "$(./bashunit "$test_file")"
  assertGeneralError "$(./bashunit "$test_file")"

  rm $test_file
}

This line should

\e[31m✗ Failed\e[0m: Error tdd with error code 127

should be:

\e[31m✗ Failed\e[0m: Error tdd
@khru khru added the enhancement New feature or request label Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant