-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pattern matching when arguments contain '*' #8
base: main
Are you sure you want to change the base?
Fix pattern matching when arguments contain '*' #8
Conversation
Because: * If the arguments string includes an '*' (asterisk) character then the bats-mock stub appears to fail to recognise the call. This change: * Quotes the `$pattern` in the arguments case comparison as this appears to resolve the issue.
I'm not sure whether This change appears to resolve the issue in question without causing any problems in my tests, but difficult to be sure of that in all cases without tests for the bats-mock project itself. |
@jasonkarns Any chance of getting this merged in? |
I'm really hesitant. This repo was created by taking the existing bats-mock "feature" out of the test suite from rbenv/ruby-build. It was extracted so that it could be pulled in as a dev dependency for nodenv/node-build (and other nodenv-* repos). This is why there isn't any real history. And also why there hasn't been meaningful work in this repo. It's mainly a snapshot in time of an embedded test utility. Ideally, the future of this module would be as a project that works in hand with https://github.com/ztombol/bats-support (and the other bats-* test libs). However, there hasn't been much thought to how that would occur, nor what bats-mock should actually look like. I'll try to experiment with this fix as applied to the test suites I know that leverage bats-mock. If it works without issue, I'll consider merging this. And I'll try to add a CONTRIBUTING.md doc outlining what I've said above about project history and future. |
Understood @jasonkarns. In the meantime, I'll fork and fix some bugs and tackle some features. If you decide to accept changes, let us know! |
Thanks for the update @jasonkarns. Understood. Unfortunately there's isn't anything telling in the |
Found a reason NOT to merge this: It disallows fuzzy matching of inputs. E.g. How about adding a parameter to |
Another method to fix this: Match both quoted and unquoted:
|
dang this is my exact issue. @Flamefire's change fixes my issue. I'm running the following arguments to |
Because:
bats-mock stub appears to fail to recognise the call.
This change:
$pattern
in the arguments case comparison as this appearsto resolve the issue.
Fixes #7