rylnd / shpec

Test your shell scripts!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Built-in "match" matcher is glob not regexp as docs claim

binaryphile opened this issue · comments

README says this about the binary matchers:

Binary Matchers
[...]
match # regex match
no_match # lack of regex match

However, the code doesn't do that, it uses the case statement to do comparison, which is globbing not regular expression matching.

Either the docs or the code should be updated.

Presuming glob matching stays, I also encountered an issue in that spaces in the match string result in a syntax error from shpec. I've made tests for this and proposed a simple fix which works for spaces (although not other whitespace, but I'm fine with that).

@binaryphile honestly, I didn't even notice when this behavior was changed in 625251 because the tests for match are incredibly lenient. After reviewing the current implementation (and keeping #97 in mind), I think I'd like to do as follows:

  1. Incorporate #97's matchers
  2. Clean up some of the more complicated assertions in our suite by using grep or egrep instead of match
  3. Rename the existing match matcher to glob
  4. Come up with better examples for glob

What do you think?

Also, I'd love to see what your solution to #104 looks like.