forked from jmdavis/dxml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, there was a problem where if someone imported a dxml module from their unit tests, they would get linker errors about symbols that dxml's unit tests imported not being found, and I couldn't figure out why. The solution was to declare the version identifier dxmlTests and using version(dxmlTests) on all of the unittest blocks and anything that had been version(unittest), which meant that dub test then didn't work without providing a custom build type which defined dxmlTests. It worked, but it was ugly. Now, I've finally figured out what the problem was. In order to instantiate the templated types so that their tests would be compiled and run, for each templated type, a module-level variable was being declared (originally as version(unittest) and then version(dxmlTests)) which instantiated the type with the correct type to compile in the tests. With version(unittest), that variable was declared when another project imported the module when building their unit tests, which meant that the template was instantiated and the tests were compiled - and then failed to compile because of symbols that weren't available. So, by moving those variables to unittest blocks, they only get compiled (and thus, the templates only gets instantiated with their tests) when compiling dxml's unit tests and not when another project using dxml compiles its tests. So, the version identifier dxmlTests is no longer necessary, and dub test works properly again.
- Loading branch information
Showing
9 changed files
with
105 additions
and
109 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
dub test --build=doCov | ||
dub test --build=unittest-cov |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.