News for hackers. Stuff that matters.
Re:In-Memory Filesystems in Rust by tayo42 on Monday August 25, 2025 @10:03AM (#45013969)
This is one nice thing about go.

I think was trying to test something in Rust and I was surprised by how many people were OK with using real file's for unit testing.

It seems like a massive oversight for being able to use rust in a corporate environment.

Re:In-Memory Filesystems in Rust by jen20 on Monday August 25, 2025 @01:52PM (#45016663)
> It seems like a massive oversight for being able to use rust in a corporate environment.

Why does being in a corporate environment matter?

Re:In-Memory Filesystems in Rust by tayo42 on Monday August 25, 2025 @03:40PM (#45018067)
Permissions are usually more strict then a hobby projects. So you can't just be writing and leaving things all over the file system without the possibility of failure.

Or maybe your using drives over a network and randomly your tests will now fail becasue of things outside your control. Things like that.

That's why when writing tests you always want them to actually do io like that.

Re:In-Memory Filesystems in Rust by bccdee on Monday August 25, 2025 @07:38PM (#45020536)
Seems like you could just put your test files in a tmpfs, if leaving files laying around is an issue.
Re:In-Memory Filesystems in Rust by tayo42 on Monday August 25, 2025 @08:09PM (#45020730)
You need to mount and unmount fikesystems to do that.

Take a look at the library mentioned,afero, and you'll see how nice it handles working with the file system in tests.

You can have everything in memory, and a whole new fs in each test

Re:In-Memory Filesystems in Rust by jen20 on Tuesday August 26, 2025 @11:26AM (#45027909)
The problem is it only tests trivial properties of the API. That might be enough for some things, but it’s not a panacea.