fix bug when test_fail is called via a do statement (for 0.98 series)

Ported bug fix and tests from the 1.5 fix to 0.98.  Tried to follow test name convention this time.

test_fail used $0 as the filename instead of the filename reported by
caller. Under normal execution these would be the same but if the test
is executed by a do block then these would no longer be the same.