#3 SHU_STR_ALL_TESTS not initialized in shuStart

open
nobody
None
5
2012-12-11
2006-08-02
mgrollins
No

This will cause SHU_STR_ALL_TESTS to contain multiple
copies of the same test function if the test script is
run repeatedly within the same shell.

For Example, if the script shUnitTest is sourced from
the current directory:

. shUnitTest

... shUnit would run and report on 8 tests

. shUnitTest

... shUnit would run and report on 16 tests (8 duplicates)

This is how I was running most of my tests at first as
I was gaining familiarity with shUnit, and I am not
sure if this would be considered normal usage. I
believe initializing SHU_STR_ALL_TESTS to an empty
string at the top of shuStart() will correct this
behavior.
shuStart() {
SHU_STR_ALL_TESTS=""
...

I have implemented this change locally, and it does not
seem to have any ill effects.

Discussion