Share

ShUnit

Tracker: Bugs

5 Confusing error message with shUnitPlus - ID: 2052932
Last Update: Comment added ( lacton )

When shUnitPlus and the tests are in different directories, shUnitPlus
write an error message.
For example, with the following structure :

errorInShUnitPlus
lib/
|-Shunit/
|-shUnit
|-shUnitPlus


and test file containing :

#!/bin/bash
export SHUNIT_HOME=lib/ShUnit
. $SHUNIT_HOME/shUnit
. $SHUNIT_HOME/shUnitPlus


the output begin with

lib/ShUnit/shUnitPlus: line 11: ./shUnit: no such file or directory

It's very confusing because when test is a success, there is an error
message. I have attached a unit test for this issue :

#!/bin/bash
export SHUNIT_HOME=lib/ShUnit
. $SHUNIT_HOME/shUnit

TestNoErrorMessage() {
errorOutput=`. $SHUNIT_HOME/shUnitPlus 2>&1`
shuStringEqual "" $errorOutput
}

shuStringEqual() {
[ x"${1}" = x"${2}" ]
shuAssert "StringEquals: ${1} vs. ${2}" $?
}

shuStart


Nobody/Anonymous ( nobody ) - 2008-08-15 09:59

5

Closed

None

Nobody/Anonymous

None

None

Public


Comments ( 2 )




Date: 2008-11-02 18:07
Sender: lacton

Fixed in release 1.5.

Enjoy!


Date: 2008-08-17 13:31
Sender: blayo


I (Philippe Blayo) forgot to register when submitting the issue "Confusing
error message with shUnitPlus".
I apologize for this Anonymous entry. I would like to add another test to
describe the behavior of shUnit as being the
same as shUnitPlus :

#!/bin/bash
export SHUNIT_HOME=lib/ShUnit
. $SHUNIT_HOME/shUnit

TestNoErrorMessageInShUnitPlus() {
errorOutput=`. $SHUNIT_HOME/shUnitPlus 2>&1`
shuStringEqual "" $errorOutput
}

TestNoErrorMessageInShUnit() {
errorOutput=`. $SHUNIT_HOME/shUnit 2>&1`
shuStringEqual "" $errorOutput
}

shuStringEqual() {
[ x"${1}" = x"${2}" ]
shuAssert "StringEquals: ${1} vs. ${2}" $?
}

shuStart

--
Philippe


Log in to comment.

Attached File ( 1 )

Filename Description Download
testSourcingShUnitPlus.sh unit test for the error message when sourcing shUnitPlus Download

Changes ( 3 )

Field Old Value Date By
status_id Open 2008-11-02 18:07 lacton
close_date - 2008-11-02 18:07 lacton
File Added 288780: testSourcingShUnitPlus.sh 2008-08-15 09:59 nobody