Unit testing framework for Bourne-based shell scripts
Unit testing framework for Bourne-based shell scripts
shunit2$ cat > test_math.sh << 'EOF'
#!/bin/bash
source shunit2
testAdd() {
result=$((2 + 2))
assertEquals 4 $result
}
. shunit2
EOF$ bash test_math.sh$ cat > test_strings.sh << 'EOF'
#!/bin/bash
source shunit2
testStringEquals() {
str="hello"
assertEquals "hello" "$str"
}
. shunit2
EOF
bash test_strings.sh