<FromGitter>
<nanobowers> Can anyone recommend a shard for getting terminal columns/rows? I'd prefer to do it in a cross platform way without having to start a process and call `tput`. I think there's a lightweight ioctl library, but would rather something a little more wrapped if possible.
<FromGitter>
<nanobowers> In case it matters, I was using IO::Console back in ruby to do this.
SamantazFox has quit [Killed (NickServ (GHOST command used by SamantazFox_))]
SamantazFox_ has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @watzon had a shard for that but i once again cannot remember the name of it
<FromGitter>
<alexherbo2> @Blacksmoke16 could it work to assign `io = IO::Delimited.new(memory_io, '\n')` so we can `pp Resource.from_json(io)`?
<FromGitter>
<Blacksmoke16> that would work yes
<FromGitter>
<Blacksmoke16> just keep in mind you'd need more than 1 `IO::Delimited` in order to parse multiple objects, and parsing an array of them might be a bit trickier as well
<SamantazFox_>
except that I changed L31 from `T.new node` to `T.new ctx, node`
<FromGitter>
<Blacksmoke16> right, but shouldn't it be like `converter: Settings::Converters::Generic(MyType)`
<SamantazFox_>
Oh.
<SamantazFox_>
I thought that it was automatically done, using the type of the property
<FromGitter>
<Blacksmoke16> not sure, i wouldn't have thought so
<FromGitter>
<Blacksmoke16> yea it doesnt, `T` is basically an uninstantiated generic afaik
<FromGitter>
<Blacksmoke16> kinda surprised it compiles
<SamantazFox_>
the weird thing is that my code did compile when that file was alone (`require`-ing it within an `eval` statement), but now it doesn't...
<SamantazFox_>
Well, yep, providing the type did it.
<SamantazFox_>
Though, it's sad that annotations require the full namespace...
<SamantazFox_>
it makes the code horrible to read
<FromGitter>
<Blacksmoke16> :shrug: could be worse
<SamantazFox_>
anyway, thanks for the help :)
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<RespiteSage> @oprypin Very satisfying to add screenshots to my crsfml-based visualization tool with only five lines.
<FromGitter>
<RespiteSage> Thanks again for writing those bindings.
Guest42 has joined #crystal-lang
Guest42 has quit [Ping timeout: 246 seconds]
<FromGitter>
<oprypin:matrix.org> 😊
<FromGitter>
<alexherbo2> `FileUtils` does not seem to accept paths, despite the `Path | String`
<hightower2>
Hey is anyone aware of a "snapshot" shard for testing? That thing where you'd run something and save results to a file (and commit to version control), and then on subsequent runs if the file is there you'd compare the current run to saved contents
<FromGitter>
<Blacksmoke16> and what if they arent the same?
<hightower2>
that's a failed test... how to solve it is a different matter then. One can either fix the code, or delete the file to cause the current version to become the new valid result. Also some module offers a way to update it to the current value via commands/options, without literally going and deleting files to cause their re-creation
<FromGitter>
<oprypin:matrix.org> yea it seems woefully missing, despite the amazing possibilities that Crystal has to help with this
<FromGitter>
<oprypin:matrix.org> i once started such a project. all i have is just a decent enough pun to use for the project's name
<hightower2>
what stopped you, lack of time or?
<FromGitter>
<oprypin:matrix.org> hmm feature creep and lack of motivation at the same time
<hightower2>
My immediate need atm is to add snapshot tests for https://github.com/crystallabs/crysterm ... There are many test programs written, and instead of adding individual tests I just want to automate running/checking those programs (i.e. run them, save all stdout to file, then compare on further runs)
<FromGitter>
<oprypin:matrix.org> hightower2, it's quick to implement. just loop on files, read something from them and assert
<hightower2>
yeah, sure... I just wanted something more "official", to learn using some existing tool as a side benefit, rather than doing it wild west style
<hightower2>
but yeah, could do that
<FromGitter>
<Blacksmoke16> KISS, just manually create the file and do the assertion and deal with automation later when/if it becomes an issue
<FromGitter>
<Blacksmoke16> ideally it would never fail 😉
<FromGitter>
<oprypin:matrix.org> & good for me to know that people call it "snapshot tests". i looked for "golden tests" for ages and thought almost nobody does it
<FromGitter>
<oprypin:matrix.org> well "almost nobody" can still be said but yea
<hightower2>
:)
<FromGitter>
<oprypin:matrix.org> hightower2, fwiw overwriting should also be easy, just check for a passed -D flag and then overwrite instead
<FromGitter>
<oprypin:matrix.org> slightly less easy is deciding how to put both input and output into the same file
<hightower2>
"despite the amazing possibilities that Crystal has" <-- you mean anything in particular, or in general the convenience of crystal for that job?
<FromGitter>
<oprypin:matrix.org> hightower2, with macros you can make amazing extra features. one idea perhaps: write updated values back into *source code*