ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
ur5us__ has quit [Ping timeout: 252 seconds]
<FromGitter> <> f1refly: you might run it under strace and see what it's doing
ur5us__ has joined #crystal-lang
[jamez] has quit [Quit: WeeChat 2.3]
deavmi has quit [*.net *.split]
HumanG33k has quit [*.net *.split]
avane_ has quit [*.net *.split]
fifr[m] has quit [*.net *.split]
oprypin has quit [*.net *.split]
SamantazFox has quit [*.net *.split]
HumanG33k has joined #crystal-lang
deavmi has joined #crystal-lang
oprypin has joined #crystal-lang
SamantazFox has joined #crystal-lang
avane_ has joined #crystal-lang
fifr[m] has joined #crystal-lang
straight-shoota has quit [*.net *.split]
jhass|off has quit [*.net *.split]
Elouin has quit [*.net *.split]
Elouin3 has joined #crystal-lang
jhass has joined #crystal-lang
straight-shoota has joined #crystal-lang
fifr[m] has quit [Ping timeout: 272 seconds]
repo has quit [*.net *.split]
jcs has quit [*.net *.split]
sevvie has quit [*.net *.split]
xybre has quit [*.net *.split]
sevvie_ has joined #crystal-lang
jcs_ has joined #crystal-lang
repo has joined #crystal-lang
jhass[m] has quit [Ping timeout: 245 seconds]
repo is now known as Guest3726
xybre has joined #crystal-lang
ur5us__ has quit [Ping timeout: 240 seconds]
elf_fortrez has joined #crystal-lang
elf_fortrez has quit [Quit: Client closed]
jhass[m] has joined #crystal-lang
<f1refly> I rebooted my computer and it's working as expected now
<f1refly> Very odd
<f1refly> Maybe my harddrave is dying?
<f1refly> *harddrive
fifr[m] has joined #crystal-lang
elf_fortrez has joined #crystal-lang
elf_fortrez has quit [Write error: Broken pipe]
elf_fortrez has joined #crystal-lang
Elouin3 is now known as Elouin
elf_fortrez has quit [Ping timeout: 246 seconds]
Guest7261 has joined #crystal-lang
Guest7261 has quit [Client Quit]
ur5us__ has joined #crystal-lang
wolfshappen has joined #crystal-lang
ur5us__ has quit [Ping timeout: 272 seconds]
wolfshappen has quit [Quit: later]
wolfshappen has joined #crystal-lang
notzmv has quit [Ping timeout: 245 seconds]
jcs_ is now known as jcs
notzmv has joined #crystal-lang
f1refly has quit [Quit: see ya in hell]
f1refly has joined #crystal-lang
Guest3726 has quit [Quit: WeeChat 3.1]
repo has joined #crystal-lang
hightower4 has joined #crystal-lang
<hightower4> Hm, is it not possible to create a method partial with named arguments? (If it is, how?)
<FromGitter> <Blacksmoke16> got an example?
<hightower4> Something like this:
<hightower4> Or better: (same example, just avoiding confusion with 'a' being both method and arg name)
<FromGitter> <Blacksmoke16> wouldnt that be confusing if you could just set the value for some arg in the middle?
<FromGitter> <Blacksmoke16> and when you call it you're really providing the first and third arg?
<hightower4> yes, it would... that's why I'd like to use all named args
<hightower4> but apparently can't?
<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> <Blacksmoke16> using a similar setup and it works fine
<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> <ondreian> ```code paste, see link``` ⏎ ⏎ seems like not []
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <ondreian> I am on `Crystal 1.1.1 [6d9a1d583] (2021-07-26)` for clarity so you know i'm not on some crazy old build
<FromGitter> <ondreian> also just cleared out `~/.cache/crystal` just to see and no joy there. Very weird
<FromGitter> <ondreian> I will just rename the tag, but seems like something hinky is going on.
<FromGitter> <asterite> you need to pass `--tag` before the path
<FromGitter> <asterite> `crystal spec --tag ... spec/cloud...` (not tested, though!)
<FromGitter> <ondreian> I tried that as well with the same outcome, even though `--help` says `[files] [runtime_options]`
<FromGitter> <ondreian> ```code paste, see link``` []
<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 ``). 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 `` file (just in case) ⏎ ⏎ ``` crystal spec --tag "terraform"``` ⏎ ⏎ but still just a silent exit []
<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 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> oha
<FromGitter> <ondreian> ```code paste, see link``` []
<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> That's the code:
<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: ⏎ 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: 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 =)
hightower4 has quit [Ping timeout: 248 seconds]
ua_ has quit [Ping timeout: 258 seconds]