bach-sh/bach

Unable to mock executable when filename contains dot

jamescooke opened this issue · 2 comments

While writing a test on a bash script that calls Python, I'm getting an error when trying to @mock python3.9.

I've reduced this to the minimum example using a.b:

test-dot() {
    @mock a.b === @stdout TEST

    a.b
}
test-dot-assert() {
    TEST
}

This gives:

/home/james/bin/bach.sh: line 381: ${mock_exec_a.b_9705119_SEQ:-0}: bad substitution
--- actual-stdout.txt   2021-05-16 21:23:48.912484029 +0100
+++ expected-stdout.txt 2021-05-16 21:23:48.936483778 +0100
@@ -1 +1,2 @@
-# Exit code: 1
+TEST
+# Exit code: 0

I've not been able to solve the problem by using single or double quotes: @mock 'python.39' or "python3.9".

Is there something I'm doing wrong? Or some tweak I need to make to the test? Or some bug in bach?

Hi, @jamescooke.

Thank you for reporting the bug, and it has been fixed. Please check out the latest code to test it.

Thanks for the quick fix - looks great and is working in my test suite 👍🏻