Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a basic 'unittest' framework #2603

Closed
wants to merge 2 commits into from

Conversation

Geod24
Copy link
Member

@Geod24 Geod24 commented Feb 27, 2023

The intent is to progressively evolve to a pure unittest framework,
removing any filesystem dependency.
While the approach introduced here is not ideal, it makes tests
much easier to write, run, and provided the framework is ported
to Windows, opens up the possibility of running them on Windows.

Writting tests for dub is quite convoluted, so this is an attempt at simplifying the process. Feedback welcome.

Copy link
Member

@s-ludwig s-ludwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't look through the individual tests, yet, but I'm in favor of this approach. We switched to a similar scheme internally some years ago, albeit without relying on fork, but rather by having a small shell script foreach over each test (calling the test binary without arguments lists all test identifiers, calling it with an argument will run the test matching the given identifier).

So AFAICS, the main open question is Windows support. It looks like we'd have to somehow compile in Posix mode for Cygwin to make the fork approach work? An alternative would be to let the main test invoke itself using std.process.execute and the command line argument approach. That way we would still stay in D land, without the need for a shell script loop.

public ~this ()
{
// destroy dir
//std.file.rmdirRecurse(this.dir);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging leftover, fixed

Geod24 added 2 commits March 4, 2023 15:14
The intent is to progressively evolve to a pure unittest framework,
removing any filesystem dependency.
While the approach introduced here is not ideal, it makes tests
much easier to write, run, and provided the framework is ported
to Windows, opens up the possibility of running them on Windows.
@Geod24 Geod24 force-pushed the dependency-injection branch from 431d22f to 09deb72 Compare March 4, 2023 14:26
@Geod24
Copy link
Member Author

Geod24 commented Dec 27, 2023

I have a better alternative: #2759

@Geod24 Geod24 closed this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants