theboocock / shunit2

Automatically exported from code.google.com/p/shunit2
0 stars 0 forks source link

Missing status report if shell interpreter dies #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Great program!

It took a while, but I found something in shunit2, version 2.1.2, that
looks a little odd. If the interpreter decides to die, then you don't
get any report, even though shunit2 may have accumulated some useful
statistics.

Here's a little example:

  boom() { x=$1; }

  test_boom()
  {
    assertEquals 1 1
    boom; # No parameter given
    assertEquals 0 $?
  }
  . ./shunit2

When I run this I get:
  #
  # Performing tests
  #
  test_boom
  ./shunit2-bug.sh: line 1: $1: unbound variable

There was an assert that ran and that tested okay. Furthermore I think
if there were other tests their status would not be reported as well.

Attached should be one possible patch to address. With this the output
you get is:

  test_boom
  ./shunit2-bug.sh: line 1: $1: unbound variable
  ASSERT:Unknown failure encountered running a test

  #
  # Test report
  #
  tests passed:     1  50%
  tests failed:     1  50%
  tests skipped:    0   0%
  tests total:      2 100%

Original issue reported on code.google.com by rocky.bernstein on 14 Jul 2008 at 9:07

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in CL# 205.

Original comment by kate.war...@gtempaccount.com on 15 Jul 2008 at 7:37