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
What's the purpose of the grave accent ` in failure messages? #470
Comments
I think this is a more or less historc typographic gimmick https://en.wikipedia.org/wiki/Quotation_mark#Typewriters_and_early_computers. With regard to your example it might be better to use ` also for closing the command, which should fix the parsing and maybe enable syntax highlighting. |
@martin-schulze-vireso , so would you favor a PR for ending with ` or simply removing ` altogether? |
It really depends on the context. Could you try what the fully `` wrapped version looks like in the environment you showed above? |
❯ bin/bats --filter "^extended syntax" test/bats.bats
✓ extended syntax
1 test, 0 failures
❯ BATS_TRACE_LEVEL=1 bin/bats --filter "^extended syntax" test/bats.bats
✗ extended syntax
(in test file test/bats.bats, line 329)
`[ "${lines[7]}" = 'ok 2 a passing test' ]` failed
+ bats-exec-suite -x /Users/norsegaud/bats-core/test/fixtures/bats/failing_and_passing.bats
❯ BATS_TRACE_LEVEL=2 bin/bats --filter "^extended syntax" test/bats.bats
✗ extended syntax
(in test file test/bats.bats, line 329)
`[ "${lines[7]}" = 'ok 2 a passing test' ]` failed
+ bats-exec-suite -x /Users/norsegaud/bats-core/test/fixtures/bats/failing_and_passing.bats
1..2
suite /Users/norsegaud/bats-core/test/fixtures/bats/failing_and_passing.bats
begin 1 a failing test
not ok 1 a failing test
# (in test file test/fixtures/bats/failing_and_passing.bats, line 2)
# `false' failed
begin 2 a passing test
ok 2 a passing test
1 test, 1 failure Is this what you mean? So we'd instead potentially change it to end in ` too? I think that looks pretty good, if not better than ' ' wrapping. |
No, I meant the environment from the screenshot above. I'd like to see if it fixes the highlighting. |
I'd like to dig more into the rationale for it existing in the first place, before we change it. I've seen this pattern frequently enough in other heavily used shell scripts and tools that I don't believe it was accidental. |
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_06_03
|
https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
This seems to be a remnant from the past. |
I think this thread established well enough that it is a typographic hack for older, non utf systems. Maybe we can offer configuration variables that allow users to decide on the delimiters? |
For interest, Commander had a similar request to change the quotes used in error messages. After some research we accepted the change. My conclusion was it was a dated convention, and I referenced one of same links as #470 (comment) |
Been there from day one: sstephenson/bats@c850527#diff-2285302ec7310b89fd9edfef3694598bebfa056fdbfd7e5d607026f64a68d734R80
It seems to work just fine when changing it to ' instead. I'd like to open this to discuss what potential downfalls there are of removing it.
The text was updated successfully, but these errors were encountered: