Skip to content

Conversation

@chitoku-k
Copy link

In some cases especially when tests failed due to err_exit, the teardown function was not executed. This PR uses trap functions to ensure it is always executed.

@setup {
  tempfile=test
  touch $tempfile
}

@teardown {
  # Here is not executed in some of the following cases
  rm $tempfile
}

@test 'case ok' {
  # This case is totally OK because `run` temporarily disables `err_exit` (using unsetopt)
  run false
}

@test 'case ng' {
  # This PR fixes this case where the test fails with `err_exit` being set
  false
}

I tried to show this by adding test cases that cover them which resulted in the entire test to break because it needs to be somehow failed...

@chitoku-k chitoku-k requested review from molovo and psprint February 1, 2020 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant