-
-
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
Nimscript target for testament #17007
Comments
Can be a symlink, Windows supports symlinks nowadays too, to skip copying the file. |
unfortunately, it matters, because So you testing nimscript doesn't replace testing vm (with our
indeed.
I highly doubt this would have any meaningful performance impact. Every compilation already generates a bunch of c files; compilation costs always dominates. But this shouldn't be needed anyways, see below.
not needed (see below) and also doesn't work at least currently because of
proposalso this is how I'd do it: # tsugar.nim
discard """
targets: "c js nimscript"
"""
template main =
... # all tests here
block: # tests `foo`
when not (defined(js) or defined(nimscript)): discard # xxx bug #xyz: not yet supported
else: ...
main()
static: main()
#[
# or we can use a pattern for that:
# in stdtest/testutils:
template testMulti*(fn) =
when defined(nimscript): fn()
else:
fn()
static: fn()
# in here:
from stdtest/testutils import testMulti
testMulti(main)
]# we could even have a vm target: BUG
links[1] Likewise, #16878 introduced a similar whitelist of modules See how this can be done with |
Summary
Testament should support a
nims
/nimscript
target.Description
Nim currently has a single nimscript test file, test_nimscript.nims, that individually gets run every time. Instead of this, we should be able to declare
nimscript
as a target for individual tests, so that we can test the VM as well as nimscript for modules that already get tested for other backends without copying the tests into test_nimscript.There are already some tests that have to generate code twice to test in the VM (though I understand the compile time VM must also be tested for multiple backends), if it's thought not to matter which backend the VM runs in a test then nimscript would help. The imports in nimscript are also outdated, new modules get added pretty frequently and existing modules can silently become importable in nimscript.
The safest way to do this is either via copying the
.nim
file of the test into a.nims
file, then running that test vianim e
, then deleting it, though this will have a considerable load on IO. Maybe a way to allow files to have a.nim
extension but still run them as nimscript would work.Alternatives
test_nimscript.nims
could individually import tests that need to be tested for nimscript, instead of copying the code directly. However import semantics could change behavior and this wouldn't be very comprehensive.Additional Information
The text was updated successfully, but these errors were encountered: