[Shunit2-users] Stubbing file tests in shUnit2
Brought to you by:
sfsetse
From: Alex H. <ale...@gm...> - 2017-07-03 06:39:54
|
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 |