jesselang / dox

Publish markdown to Confluence as HTML
MIT License
23 stars 5 forks source link

Testing with afero #15

Closed jesselang closed 4 years ago

quorten commented 4 years ago

The question of how to mock for filesystem testing is an interesting one. Language-wise, afero makes for a nice Golang interface for testing everything, but also it feels like it is adding another layer of complexity that isn't strictly needed.

"Linux" Docker containers today seem like they have provided a really nice solution for exactly this case where you may want to create a blank filesystem for testing things like FindRepoRoot(), and be able to do so in a way that's not dependent on a particular developer's operating system. It might be worth considering alternative ways to write these tests.

jesselang commented 4 years ago

"Linux" Docker containers today seem like they have provided a really nice solution for exactly this case where you may want to create a blank filesystem for testing things like FindRepoRoot(), and be able to do so in a way that's not dependent on a particular developer's operating system. It might be worth considering alternative ways to write these tests.

Interesting take. The way I see it, the testing "fixture" needs to live somewhere in some form, and whether using containers or not, that fixture would likely be encoded in the test. Making containers a requirement for testing doesn't seem like the direction I want dox to go. I want to support non-Linux operating systems. Introducing this complexity to adequately test this portion of code seems like a reasonable solution.

quorten commented 4 years ago

Any idea why the tests were failing on Windows? At the outset it looks like it may be a bug in afero or something that is unrelated to the primary test code.