kward / shunit2

shUnit2 is a xUnit based unit test framework for Bourne based shell scripts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next release ?

williamdes opened this issue · comments

Hi @kward

Could we have a git tag for your latest changes ?

2.1.9pre would perfect, so we can test if there is breaking changes, for example with Debian packages.
That are broken currently: https://tracker.debian.org/pkg/shunit2

I reviewed diff for v2.1.8...master excluding test files

List of interesting fixes:

This tests run fine on 2.1.6 and not 2.1.8: https://salsa.debian.org/debian/icmake/-/blob/debian/latest/debian/tests/run-unit-test

You can clone and run the file to test. I reduced it to this example

#!/bin/sh

set -u

test_foobar () {
    assertEquals "foo" "foo"
    assertEquals "bar" "bar"
}

testFindString() {
    local OUT="And another 'hello world'"

    assertNotSame "missing output from icmake -e" "" "${OUT}"
    #assertTrue echo "${OUT}" | grep -q "And another 'hello world'"
}

testTrueIsTrue() {
    assertTrue "true"

    # shunit's function examples
    assertTrue 0
    assertTrue "[ 34 -gt 23 ]"

    # shunit's function examples for fail
    assertTrue 123
    assertTrue "test failed" "[ -r '/non/existent/file' ]"

    assertTrue "1"
}

testFalseIsFalse() {
    assertFalse "false"

    # shunit's function examples
    assertFalse 1
    assertFalse "[ 'apples' = 'oranges' ]"

    # shunit's function examples for fail
    assertFalse 0
    assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]"

    assertFalse "0"
}

. shunit2

I think this shunit2:ERROR testTrueIsTrue() returned non-zero return code. should be fixed before the final version is out.
It's a bug that was not present on the old version

2.1.6

(removed set -e)

test_foobar
testFindString
testTrueIsTrue
ASSERT:
testFalseIsFalse
ASSERT:

Ran 4 tests.

FAILED (failures=2)

2.1.8

(removed set -e)

test_foobar
testFindString
testTrueIsTrue
ASSERT:
shunit2:ERROR testTrueIsTrue() returned non-zero return code.
testFalseIsFalse
ASSERT:
shunit2:ERROR testFalseIsFalse() returned non-zero return code.

Ran 4 tests.

FAILED (failures=4)

Seems to be #154 and #162 too

I found out that #84 (f08632b#diff-a453761d888ea6645a651da189e89605523e4eab9500ee9e5988e55bca4f437bR892-R896) was the reason why the tests did not output an error before