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] Re: Shell script testing functions

2018-06-09 Thread Adrian Grigore
Sorry, minor bugs fixed. #!/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" tap_exitstatus=1 } tap_test() { lastexitstatus=$? ! $tap_inited && current="$1" && ta

[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