Skip to content
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

"No Arguments" descriptor is annoying to use #9

Closed
ghost opened this issue Apr 21, 2022 · 4 comments
Closed

"No Arguments" descriptor is annoying to use #9

ghost opened this issue Apr 21, 2022 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 21, 2022

Since 447edb6
there is a visualization for "no arguments passed".

Some tests written against this library before this commit now fail with things like:
Bildschirmfoto 2022-04-21 um 19 26 55

Making those tests pass again is annoying, because the descriptor that is to be pushed
into the verification is using a lot of escape sequences.

The only way I found to make those test pass is to

BACH_NO_ARGUMENTS_SIGN=$'\x1b\x5b31m\u2205\x1b\x5b0m'
pushd"  "$BACH_NO_ARGUMENTS_SIGN

Maybe I'm missing something, but this I don't find ergonomic. Copy&pasting the
sign from terminal into the editor did not work due to the "red" escape sequence
not being copied.

@chaifeng
Copy link
Collaborator

Hi, thank you for this issue.

Yes, the name can be a bit confusing, but it is mainly used within Bach. A better name for this sign would be "empty argument" or "empty string"

It happens when we pass an empty string to a command

test-pass-an-empty-string() {
    foobar ""
}
test-pass-an-empty-string-assert() {
    foobar
}

Another case is we want to assign output from a command to a variable, but we forgot to mock that command

test-forgot-to-mock-a-command() {
    foobar "$(forgot-to-mock-this-command param1 param2)"
}
test-forgot-to-mock-a-command-assert() {
    foobar
}

@ghost
Copy link
Author

ghost commented Apr 22, 2022

Hi, thanks for your quick response. Your example is a perfect example of the issue, this happens if you run it:
Bildschirmfoto 2022-04-22 um 09 13 21

but it is mainly used within Bach

So that's not true, it immediately bubbles to the end-user, who then has to find an ugly workaround.

Greetings!

@chaifeng
Copy link
Collaborator

chaifeng commented Apr 22, 2022 via email

@ghost
Copy link
Author

ghost commented Apr 22, 2022

Aahh thanks again, yeah, so the "" is needed to make the test pass, not the cryptic escape sequence. Works fine now 👍 I guess this is more of a documentation issue then.

chaifeng added a commit that referenced this issue Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant