<FromGitter>
<Blacksmoke16> but named args would make it so you could supply the 2nd of 3 args and skip the first
<FromGitter>
<Blacksmoke16> which you cant do via positional args
<FromGitter>
<Blacksmoke16> as it requires they be positional, in order of the defined args
<hightower4>
ok, too bad, found a great place to use partials, but need named args :)
<hightower4>
thanks
<FromGitter>
<Blacksmoke16> any reason you just cant use positional args?
<hightower4>
yes, the method I'm trying to call in the end only accepts named args
<hightower4>
i.e. def something(*, a, b, c)
<hightower4>
and even if it didn't have * in front, it supports many (optional) named args, and trying to remember which position they're in would be unmanageable
<FromGitter>
<Blacksmoke16> and to be clear, you're converting this method into a proc? Or was that just an example?
<FromGitter>
<Blacksmoke16> because i dont even think you can call the proc if the method has required named only args
<FromGitter>
<Blacksmoke16> and that might be/is probably a bug
<hightower4>
ah indeed, that's the problem even before the partial
<hightower4>
ouch
<hightower4>
Interesting limitation
notzmv has quit [Ping timeout: 272 seconds]
avane_ has quit [Ping timeout: 272 seconds]
notzmv has joined #crystal-lang
<FromGitter>
<ondreian> 👋 I recently divided up a bunch of tests using a tag `terraform`, basically a couple of `describe` blocks now `tags: "terraform"` and running `crystal spec --tag "~terraform"` executes as I would expect (runs all tags not tagged with `terraform`), but `crystal spec --tag "terraform"` just exits silently with status 0 and no tests appear to have been run, even if I add the `-v` flag
<FromGitter>
<Blacksmoke16> what if you drop the quotes
<FromGitter>
<ondreian> removing the quotes doesn't seem to have an effect, I have also done this before with tagged tests. If I change the tag from `terraform` it works
<FromGitter>
<ondreian> like if I rename it `with-terraform`
<FromGitter>
<Blacksmoke16> oh interesting
<FromGitter>
<ondreian> Do make matters even weirder, I just bootstrapped a new app using `crystal init app tag-test` and added the `terraform` tag to the skeleton spec there and it works as expected
<FromGitter>
<Blacksmoke16> does it work if you just run the one file on its own?
<FromGitter>
<asterite> also happens without the quotes around terraform?
<FromGitter>
<ondreian> yup
<straight-shoota>
That is really weird
<straight-shoota>
The MissingOption error suggests something weird is happening. But you said, originally there was no error, the specs just didn't execute anything?
<straight-shoota>
And that error only shows up when you run a specific file? Or any file?
<straight-shoota>
Maybe you can add some diagnostic instrumentation to the spec runner (in stdlib location at `spec.cr`). Something like `p! Spec.option_parser.@handlers`
<FromGitter>
<ondreian> I changed the tag back to `terraform` and added `p! Spec.option_parser.@handlers` to the first line of the file containing the `describe` block with that tag, as well as the `spec_helper.cr` file (just in case) ⏎ ⏎ ``` crystal spec --tag "terraform"``` ⏎ ⏎ but still just a silent exit [https://gitter.im/crystal-lang/crystal?at=6111924e7bc44d0a47129b1e]
<FromGitter>
<ondreian> it happened on a Circle CI server as well, so not just my machine (also changed my shell from fish to basic `sh` just to be sure it wasn't something weird there)
<straight-shoota>
Please try adding that p! line to spec.cr in the stdlib (or copy that file to a local folder and include it instead of the stdlib's)
<FromGitter>
<ondreian> aha
<FromGitter>
<ondreian> if I add a `terraform` folder (where all the terraform scripts go) it happens
<FromGitter>
<ondreian> even on a fresh `crystal init`
<straight-shoota>
Okay, then you probably can use --tag=terraform syntax and it works
<FromGitter>
<ondreian> yup, that is true
<FromGitter>
<ondreian> ` crystal spec --tag="terraform"` works perfectly (even if the folder is present)
<straight-shoota>
Then culprit is the `crystal spec` command, which is more or less just an alias for `crystal run` which also gathers files to run specs on.
<straight-shoota>
It recognizes any argument that also exists as a folder as a path argument
<straight-shoota>
That's just pretty dumb, but the compiler command can't know any better because it does not actually parse the runtime spec options
<straight-shoota>
It does not know that `--tag terraform` is an option name plus value
<straight-shoota>
An example of the opposite interpretation would be `--error-trace terraform`: `--error-trace` does not receive a value, so `terraform` is a positional argument
<FromGitter>
<ondreian> yeah, appreciate the explanation. I think documenting this oddity would be a good fix, all of the official documentation at: https://crystal-lang.org/reference/guides/testing.html#tagging-specs ⏎ Doesn't even mention using `=` syntax, when that should probably be the default
<FromGitter>
<ondreian> which is part of the reason why I was so confused
<straight-shoota>
definitely
<straight-shoota>
= syntax is just much more reliable
<FromGitter>
<ondreian> I opened a PR to document this behavior: https://github.com/crystal-lang/crystal-book/pull/535 but my brain is about dead for the day so someone should definitely proof read it :slight_smile:
ur5us__ has joined #crystal-lang
<straight-shoota>
Great!
<straight-shoota>
Btw. your PR is the first one that gets an automated deploy preview =)