Re: [Shunit2-users] Stubbing file tests in shUnit2
Brought to you by:
sfsetse
From: Alex H. <ale...@gm...> - 2017-07-04 07:56:40
|
Hi all, I have discovered the project on Github: https://github.com/kward/shunit2 I assume I can raise this as an issue there and send in a pull request. Thanks, alex On 3 July 2017 at 16:39, Alex Harvey <ale...@gm...> wrote: > Hi all, > > I write about this question I asked at Stack Overflow here: > stackoverflow.com/questions/44870065/stubbing-file-tests- > in-shunit2/44870101 > > As pointed out in that post, it is possible to stub the shell file tests > using code like: > > [() { > case "$*" in > "-x /usr/local/rvm/bin/rvm") > false > ;; > esac > } > > > Unfortunately, this breaks shUnit2 itself. > > It is suggested in the above that this issue could be avoided if all calls > to external commands in shUnit2 were prefixed by command: > > E.g. instead of (on line 17) > > [ -n "${SHUNIT_VERSION:-}" ] && exit 0 > > > we would have > > command [ -n "${SHUNIT_VERSION:-}" ] && exit 0 > > > I tested this - and applied to a few other commands that a user might want > to stub, like rm, mkdir, cat etc. > > Is it possible for me to send in a patch? Does anyone see any potential > issue with what I am proposing here? > > Thanks, > Alex > > > > |