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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fluently-readable "exist" matcher #220

Conversation

robert-gurol-signavio
Copy link
Contributor

I'm working a lot with technical writers, lately.
They suggest that the "[path] be exist" matcher be renamed, so that the behavior-driven code can be read more fluently.

Given the constraints of the formal syntax, "[path] exists" may be too far off (at least, for my skills as a contributor), so I'm suggesting "[path] be existent".

In the Java world, I have worked with developers who are really perfectionist about fluent APIs (in Java, stuff like .matches(aRegex).and().isANumber()), there are definitely the kind of programmers who appreciate this :)

My colleague pointed out that I should make this clear: I do not mean this to be a condescending thing to point out grammar issues, and I hope that's not how it comes across.
Personally, I'm using this ticket as motivation to dig a bit into the shellspec code, ... and to fix a typo I submitted recently 馃槄 (that one off-ticket commit in there - I hope you don't mind).


What I tested locally: I ran this, and it worked without test failures.

$ ./contrib/all.sh ./shellspec
Linux dev-106 5.11.0-17-generic #18-Ubuntu SMP Thu May 6 20:10:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
==================================================
      sh : /usr/bin/sh -> /usr/bin/dash
     ash : ----
    dash : /usr/bin/dash
    bash : /usr/bin/bash
     zsh : /usr/bin/zsh
   pdksh : ----
     ksh : ----
   ksh93 : ----
    mksh : ----
    oksh : ----
    yash : ----
    posh : ----
 busybox : /usr/bin/busybox
==================================================
[...]

For downward compatibility, keep the alternate
"be exist" matcher.
... one of which is by me m(
@ko1nksm
Copy link
Member

ko1nksm commented May 30, 2021

Thanks for the great suggestion and pull request. Actually, it has already been suggested by @jocutajar (#179 and see also #178). Currently, due to personal priorities (#216), I do not have enough time to develop ShellSpec.

Given the constraints of the formal syntax, "[path] exists" may be too far off (at least, for my skills as a contributor), so I'm suggesting "[path] be existent".

What you mean is that [path] exists is better? If so, we should choose it. My guess is that if you create lib/core/matchers/exists.sh and write the similar code with this as a reference, it should work.

However, @jocutajar's suggestion is not exists, but exist. I don't know which is more appropriate (because my native language is not English).

there are definitely the kind of programmers who appreciate this :)

I am one of them :P

I want ShellSpec to be perfect. However, I can write programming languages, but I am not good at writing English language. I would have really liked to discuss and decide on a fluent API, But there were not enough users to make that decision right away. However, it may be possible to do so now. I have created a discussion (#221).

to fix a typo I submitted recently 馃槄 (that one off-ticket commit in there - I hope you don't mind).

I merged it ahead of time. Please rebase.

@ko1nksm
Copy link
Member

ko1nksm commented Jun 5, 2021

Based on #221 (comment), I agreed to the change to should be exist.

@robert-gurol-signavio Can you continue the work? My guess is that it's not that difficult. If you are not sure, feel free to ask. (but, I may not be able to reply right away.)

@robert-gurol-signavio
Copy link
Contributor Author

Thank you for your input in #221 (comment) ! 馃檱

I'll go with that comment as a base, and close this pull request for now.

I'm on leave this week, I will continue earliest on 2021-06-13.

@robert-gurol-signavio robert-gurol-signavio deleted the more-fluent-exist-matcher branch June 6, 2021 07:32
@robert-gurol-signavio robert-gurol-signavio restored the more-fluent-exist-matcher branch June 6, 2021 07:32
@robert-gurol-signavio robert-gurol-signavio deleted the more-fluent-exist-matcher branch July 31, 2021 11:00
@phil-hands
Copy link

However, @jocutajar's suggestion is not exists, but exist. I don't know which is more appropriate (because my native language is not English).

I've not actually used shellspec (yet :-) ) but noticed this issue, and thought I might be able to add something.

I take it that the language is supposed to be asserting that a particular path exists.

If so, the 'be' forms are all somewhat ugly, but the closest to proper English is 'be existent' -- In British English at least 'be present' would be a more natural way of expressing that idea, but is probably less obvious to non-native speakers.

If it's possible to make it work without the 'be' then [path] exists version is much more natural, and makes it obvious what is being tested for.

HTH

@robert-gurol-signavio
Copy link
Contributor Author

@phil-hands #233 is merged, if you install ShellSpec at master branch level, you can use "exists" now :)

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

Successfully merging this pull request may close these issues.

None yet

3 participants