Bug 22730 – master: "dmd -i" doesn't include unit tests from imported modules
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-03T14:31:38Z
Last change time
2022-02-18T12:16:01Z
Keywords
pull
Assigned to
No Owner
Creator
duser
Comments
Comment #0 by duser — 2022-02-03T14:31:38Z
// main.d
import mod;
void main() { assert(0, "main() called"); }
// mod.d
unittest { assert(1); }
% dmd -i -unittest -run main.d
[email protected](2): main() called
with dmd 2.098.1, the output is "1 modules passed unittests"
according to bisect, this was caused by: https://github.com/dlang/dmd/pull/13224
Comment #1 by dlang-bot — 2022-02-15T02:24:20Z
@MoonlightSentinel created dlang/dmd pull request #13654 "Fix 22730 - Promote imported files (-i) to root module before parsing the declarations." fixing this issue:
- Fix 22730 - Promote imported files (-i) to root module before parsing...
... the declarations.
DMD PR 13224 changed the parser s.t. unittests from non-root modules
are skipped, i.e. not even parsed. The new behaviour didn't work as
expected when combined with `-i` because it promoted imported files to
root modules *after* the parser processed the entire file.
This commit moves the existing checks s.t. they are applied immediatly
after the module declaration was read by the parser.
https://github.com/dlang/dmd/pull/13654
Comment #2 by dlang-bot — 2022-02-16T06:10:52Z
dlang/dmd pull request #13654 "Fix 22730 - Promote imported files (-i) to root module before parsing the declarations." was merged into stable:
- ea623dbb38b51ab9a0d11bc0fad79d392c66de98 by MoonlightSentinel:
Fix 22730 - Promote imported files (-i) to root module before parsing...
... the declarations.
DMD PR 13224 changed the parser s.t. unittests from non-root modules
are skipped, i.e. not even parsed. The new behaviour didn't work as
expected when combined with `-i` because it promoted imported files to
root modules *after* the parser processed the entire file.
This commit moves the existing checks s.t. they are applied immediatly
after the module declaration was read by the parser.
https://github.com/dlang/dmd/pull/13654
Comment #3 by dlang-bot — 2022-02-18T12:16:01Z
dlang/dmd pull request #13685 "Merge stable into master" was merged into master:
- 1c31d85613070cc547b166b464cff75bdf27bfa2 by MoonlightSentinel:
Fix 22730 - Promote imported files (-i) to root module before parsing...
... the declarations.
DMD PR 13224 changed the parser s.t. unittests from non-root modules
are skipped, i.e. not even parsed. The new behaviour didn't work as
expected when combined with `-i` because it promoted imported files to
root modules *after* the parser processed the entire file.
This commit moves the existing checks s.t. they are applied immediatly
after the module declaration was read by the parser.
https://github.com/dlang/dmd/pull/13685