-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
move tests under the compiler directory to testament #16096
Conversation
I think some |
I'm not sure the changes to parser.nim preserve the old semantics. We do |
Yeah but the old way was better, change the grammar and get a basic check for free. |
09eab6f
to
c7681b5
Compare
|
Merging it for now but I'm not convinced it's that a good idea. These tests now run on every commit but should only run when we change the related logic. |
Yea, I agree. Before if using
|
this PR is a net improvement; those tests were never run before PR because of current testament logic, and even if testament would've been modified to run those, it's better to run them as separate module rather than
this is always going to be brittle because of dependencies, a seemingly unrelated change in some dependency can break code. Unless there's a benchmark showing CI runtime is significantly impacted (which i doubt), it's best to just run those on each commit. In fact moving tests to separate files instead of isMainModule reduces test time because they can be joined via megatest. |
@@ -0,0 +1,26 @@ | |||
include compiler/[nimblecmd] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xflywind instead of include
how about, in a followup PR:
import compiler/[nimblecmd,options,lineinfos]
import std/[strtabs,sequtils]
# in nimblecmd.nim:
when defined(testing):
export chosen, addPackage
(seems to work when i checked)
note that {.privateImport.} (#11865) would be much better (no global effect on other modules) but until it's merged the above snippet is still the better option, compared to include
, which has many issues (as explained in #11865, in particular when a module will end up being duplicated)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason why .privateImport
doesn't have "many issues" is because almost nobody used it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason why .privateImport doesn't have "many issues" is because almost nobody used it.
@Araq the reason nobody used it except myself is because the PR still hasn't been merged.
I've rebased it recently to address bitrot conflicts with devel so it should still be good to go / ready to address any further review comments.
besides having extensive tests in the PR, the safeguards are in place:
not only you can do --experimental:allowPrivateImport
, but it can also be pushed/popped for more targetted use:
# in tnimblecmd
{.push experimental: "allowPrivateImport".}
from nimblecmd {.privateImport.} import chosen, addPackage
...
{.pop.}
=> other modules importing nimblecmd won't see chosen
, addPackage
, and nimblecmd
won't be
duplicated, breaking modularity and other common issues with include
(cherry picked from commit 57bd645)
tbtrees.nim
:BTree.entries
is not exported, so I chooselen
instead.tnimblecmd.nim
:inlcude
because some procs are not exported.@["irc-#head", "another-0.1", "ab-0.1.3", "justone-1.0"]
to@["irc-#head", "ab-0.1.3", "justone-1.0", "another-0.1"]
tprefixmatches.nim
:echo
todoAssert