Re: [dev] Shell script testing functions

2018-06-21 Thread Jens John
On Sat, 9 Jun 2018, at 17:19, Adrian Grigore wrote: > I sometimes enjoy testing my shell scripts. Opinions? If you're looking into writing effective unit tests for your shell projects, I highly recommend to run the script itself as well as the test in a controlled environment. Treat the environm

Re: [dev] Shell script testing functions

2018-06-09 Thread Adrian Grigore
> 1) use shellcheck. Check out shellcheck.net or install locally. It catches the most common shell scripting problems. I already do. Thanks for the other recommendations. On Sat, Jun 9, 2018 at 6:32 PM Evan Gates wrote: > > On Sat, Jun 9, 2018, 08:20 Adrian Grigore > wrote: > > > I sometimes enj

Re: [dev] Shell script testing functions

2018-06-09 Thread Evan Gates
On Sat, Jun 9, 2018, 08:20 Adrian Grigore wrote: > I sometimes enjoy testing my shell scripts. Opinions? I'm away from my computer so I can't give full feedback but for now I'd recommend 1) use shellcheck. Check out shellcheck.net or install locally. It catches the most common shell scripting p

[dev] Shell script testing functions

2018-06-09 Thread Adrian Grigore
I sometimes enjoy testing my shell scripts. Opinions? #!/bin/sh tap_inited=false tap_i=0 tap_exitstatus=0 tap_printline() { [ "$1" -eq 0 ] && printf "ok %d - %s\n" $tap_i "$current" && return; printf "not ok %d - %s\n" $tap_i "$current" exitstatus=1 } tap_test() { lastexitstatus=$? ! $tap_ini