Convert unittests in .d files to use d-lang unittests#141
Open
Alex-Muirhead wants to merge 11 commits intomasterfrom
Open
Convert unittests in .d files to use d-lang unittests#141Alex-Muirhead wants to merge 11 commits intomasterfrom
.d files to use d-lang unittests#141Alex-Muirhead wants to merge 11 commits intomasterfrom
Conversation
6094904 to
3345864
Compare
Collaborator
Author
|
Removed all the final |
944967d to
c88f2fc
Compare
9b4e6ec to
f06262c
Compare
cd1927d to
28fdad1
Compare
To make this play nicer with our existing d-unittests, we create a separate test_gas_calc file, and ensure we build gas-calc before running the tests. This new test_gas_calc uses std.process to launch the compiled gas-calc.
This makes the intention clearer than using a filter operation, however runs the risk of the relative path being incorrect if moved.
28fdad1 to
843e98c
Compare
Collaborator
|
Is this waiting for me Alex? Sorry I thought we had merged this. |
Collaborator
|
I looked over this, but didn't action.
I'm happy with the ".d" style unittests.
Nick, can you please sense check then merge if you're happy?
…On Fri, 13 Feb 2026, 4:07 pm Nick Gibbons, ***@***.***> wrote:
*uqngibbo* left a comment (gdtk-uq/gdtk#141)
<#141 (comment)>
Is this waiting for me Alex? Sorry I thought we had merged this.
—
Reply to this email directly, view it on GitHub
<#141 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWONKBYOTME3LM7WWZCX3VL4LU5WZAVCNFSM6AAAAACG52I3RSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQOJUGU2TSNZUG4>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Collaborator
Author
|
@uqngibbo I believe we reviewed it, and merged only the tests for one D module to see if it would have any problems, so this PR would be for all the D modules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Current unittests in D source files use
tclscripts for testing, and generate a separate executable for each unittest (enabled using specific version flags). This leaves 3 points of failure:tclscript for testingBy converting all unittests to use the specific
unittestblock (enabled via the--unittestflag), we can compile an entire module to a single executable that runs all tests. As long as the file is marked as a source file, any unittests it contains will be correctly run.Additions
However, the default test-runner for D is extremely noisy (listing entire stack traces for assertion failures), without adding much information.
Example verbose output
For a single assert fail:
I've added a separate
test_runner.dfile tosrc/utils/that aims to emulate the output of PyTest (already used inexamples/).Example test_runner output
Features
--unittest) will have their unittest run. This is usually more information than required. The executable generated bytest_runner.dhas a--module <name>option, which filters tests down to those belonging to modules starting with<name>(i.e.--module gas.diffusionwill only run tests withingas/diffusion/).stdoutcapturing: The previous unittesting would fail a test if it wrote tostdout(viawritelnetc). Within the new framework, any output is captured, and only displayed in the error description of failed/errored tests. This helps with debugging tests without cluttering the output / causing false positives.util.test_runnermodule contains askip(string message = "Skipped test")function, and the relevant unittest won't count as failed or errored. This function won't cause any problems with existing test runners.Notes
makefiles for these modules contain combinations oftest,test-all,test-real, andtest-complextargets. A unified naming convention would be best.