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

dangerous! shunit2 false positive when test includes syntax error #84

Closed
eedwards-sk opened this issue May 8, 2018 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@eedwards-sk
Copy link

2.1.7

Note that it never actually runs the assertion. It seems to bail on the syntax error, and stop the rest of the function from executing, but then shunit2 reports it as a success.

This is bad since it will hide failing tests.

#!/usr/bin/env bash

thing_with_syntax_error() {
  ${!#3442} -334 a$@2[1]
}

test_thing() {
  thing_with_syntax_error
  
  assertEquals '' 'true' 'false'
}

source shunit2

output:

test_thing
../tests/ut/list/add.test: line 4: ${!#3442}: bad substitution

Ran �[1;36m1�[0m test.

�[1;32mOK�[0m
PASS tests/ut/list/add.test (exit status: 0)
@kward kward closed this as completed in f08632b May 11, 2018
@kward kward self-assigned this May 11, 2018
@kward kward added the bug label May 11, 2018
@kward kward added this to the 2.1.8 milestone May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants