photog.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A place for your photos and banter. Photog first is our motto Please refer to the site rules before posting.

Administered by:

Server stats:

271
active users

#unittest

0 posts0 participants0 posts today

UwU, I've just found out about `SystemState` in #Bevy :awesome:

docs.rs/bevy/latest/bevy/ecs/s

It basically allows you to circumvent (mutable) borrowing issues with `App` and `World` when you have exclusive `World` access.
As it turns out, this is especially useful in #UnitTests. 🧪 ✅

See next two toots for an example...

1/3

docs.rsSystemState in bevy::ecs::system - RustHolds on to persistent state required to drive `SystemParam` for a `System`.
Replied in thread

@shuttle I consequently use #TDD, where possible.

Yes, sure, #Rust prevents a lot of bugs at compile time already, but not logic bugs.

For example in #CSVDiff we have ~70 unit tests and ~12 integration tests. The only "bug report" we have ever gotten was due to a corrupted CSV file (being mistaken with a bug in diff):

See here (qsv):
github.com/jqnatividad/qsv/iss

csv-diff:
gitlab.com/janriemer/csv-diff

In the future I'd like to add property and mutation testing as well 🤓

GitHubBUG: qsv diff fails for different delimiters for the left and right CSV files · Issue #1258 · jqnatividad/qsvBy a5dur

And this is why #UnitTests and #TDD are awesome/necessary (even in #Rust/ #RustLang):

The original requirement:
figure out how many columns the _result_ of diffing two CSVs in #CsvDiff have.

Do you see the error-pattern?

It's
- when we have no diff
&&
- at least one CSV has headers

which makes sense, because I've implemented the feature in the diffing logic, but at that point header information is already lost (in some other thread).

Isn't that beautiful!?🥰

It's release day! 🎉

We just shipped v2 Core Framework 2.5.0, Analyzers 1.2.0, and Visual Studio adapter 2.5.0. This release includes a bunch of quality of life improvements, bug fixes, and an overhauled assertion library that includes new assertions, new overloads, and much better (and most consistent) assertion failure messages.

Enjoy!

Release notes:

xunit.net/releases/v2/2.5.0
xunit.net/releases/analyzers/1
xunit.net/releases/visualstudi

xUnit.netRelease Notes for July 6, 2023Documentation site for the xUnit.net unit testing framework

Writing a #UnitTest for each significant piece of my #Python code is a pain in the ass. Sometimes it feels like I spend most of my #programming time writing test code instead of the stuff I actually want.

But then I add a feature or optimize something and debugging is as simple as making various tests pass again and I’m glad to have invested all that time in the parallel universe of a well-built test suite.

It’s like wearing an N95 during a pandemic, except for your code instead of your brain.