Seeing tests fail in this repo
Hey there! I found your script on a comment you made on HN and was eager to try it. Upon cloning and installing, I wasn't able to get it to run as intended and am seeing your tests fail
❯ ./tests
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
$0.00 0.00 $150.00 1 acme
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
$0.00 0.00 $150.00 1 example
pass 2h 30m == 2.50
pass 02h 30m == 2.50
pass 2h30m == 2.50
pass 02h30m == 2.50
pass 2:30 == 2.50
pass 02.50 == 2.50
pass 2.5 == 2.50
pass 2h == 2.00
pass 2h 0m == 2.00
pass 02h == 2.00
pass 02h 00m == 2.00
pass 2 == 2.00
pass 02 == 2.00
pass 30m == 0.50
pass 0h 30m == 0.50
pass 00h 30m == 0.50
pass 00h 30 == 0.50
pass 0h30m == 0.50
pass 00h30m == 0.50
pass 0:30 == 0.50
pass 00:30 == 0.50
pass :30 == 0.50
pass 90m == 1.50
pass 180m == 3.00
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
fail acme/log.md 2019 == $0.00 0.00 $150.00 1 acme (expected $1266.00 6.33 $200.00 4 acme)
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
pass acme/log.md 2019/01 == $0.00 0.00 $150.00 1 acme
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
fail example/log.md 2019 == $0.00 0.00 $150.00 1 example (expected $742.35 17.50 $42.42 4 example)
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
fail example/log.md 2019/01 == $0.00 0.00 $8080.50 1 example (expected $18181.12 2.25 $8080.50 2 example)
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
fail log.md 2019 == $0.00 0.00 $150.00 1 tests (expected $2925.00 19.50 $150.00 4 tests)
Hi,
What OS are you using? I wonder if there's a difference in grep flags. I know there's differences between the gnu version of grep vs what's on macOS and maybe freebsd.
I'm running Ubuntu 20.04 here and I get this when I run the test suite using GNU grep 3.4:
pass 2h 30m == 2.50
pass 02h 30m == 2.50
pass 2h30m == 2.50
pass 02h30m == 2.50
pass 2:30 == 2.50
pass 02.50 == 2.50
pass 2.5 == 2.50
pass 2h == 2.00
pass 2h 0m == 2.00
pass 02h == 2.00
pass 02h 00m == 2.00
pass 2 == 2.00
pass 02 == 2.00
pass 30m == 0.50
pass 0h 30m == 0.50
pass 00h 30m == 0.50
pass 00h 30 == 0.50
pass 0h30m == 0.50
pass 00h30m == 0.50
pass 0:30 == 0.50
pass 00:30 == 0.50
pass :30 == 0.50
pass 90m == 1.50
pass 180m == 3.00
pass acme/log.md 2019 == $1266.00 6.33 $200.00 4 acme
pass acme/log.md 2019/01 == $816.00 4.08 $200.00 2 acme
pass example/log.md 2019 == $742.35 17.50 $42.42 4 example
pass example/log.md 2019/01 == $18181.12 2.25 $8080.50 2 example
pass log.md 2019 == $2925.00 19.50 $150.00 4 tests
Hey @adityamookerjee, I just found this script and I am running mac os. The solution I found was to install grep via Homebrew (brew install grep). Then in your .bash_profile or .zshrc set the path to PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
Hi,
Yep, the tests require the GNU version of sed which is installed on Linux by default. The macOS version has different flags and functionality.
Thanks for reporting that, if you want to take a shot at altering the code to work with the default version of sed on macOS and Linux by default I'm open for that. If not maybe a PR to add a comment to the test script calling out what you wrote about needing the GNU version of sed is a reasonable alternative.