lehmannro / assert.sh

bash unit testing framework
GNU Lesser General Public License v3.0
487 stars 57 forks source link

Not working on Mac OS X 10.7.5 #3

Closed duksis closed 11 years ago

duksis commented 11 years ago

Tried to run the test suite and got the following:

$ ./tests.sh 
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
all 8 demo tests passed in s.
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
test #8 "_clean INVARIANT=;
assert_end | egrep 'all 0 tests passed in [0-9].[0-9]{3}s'" failed:
    program terminated with code 1 instead of 0
1 of 9 output tests failed in s.
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
all 7 regression tests passed in s.
duksihug@WL038424 ~/code/assert.sh (master)
$ echo $BASH_VERSION
3.2.48(1)-release

looks like one of the causes is that the default date command shipped with mac os does not have a %N (nanosecond) formatting option https://github.com/lehmannro/assert.sh/blob/master/assert.sh#L66

P.S. Great project - would love to use it.

lehmannro commented 11 years ago

Thanks for the report! date indeed seems to be the culprit: It leaves straw %N tokens around when it cannot understand them. Subsequently, bc trips up when trying to calculate 123.%N - 120.%N. It should be fixed in b7a4213106ae410921f692f3f122aad0fb49accd — can you confirm?

duksis commented 11 years ago

Not sure if this was intended that way but b7a4213 returns the github 404 page

lehmannro commented 11 years ago

Could you try again? It works for me now.

duksis commented 11 years ago

the link works now, but the test suite don't

$ ./tests.sh 
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
all 9 demo tests passed in s.
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
test #8 "_clean INVARIANT=;
assert_end | egrep 'all 0 tests passed in [0-9].[0-9]{3}s'" failed:
    program terminated with code 1 instead of 0
1 of 13 output tests failed in s.
(standard_in) 1: illegal character: N
(standard_in) 1: illegal character: N
all 7 regression tests passed in s.
duksis commented 11 years ago

Added code that works for me: