Change the test command to use the sandboxed runtime instead of evalPureUnison#6169
Change the test command to use the sandboxed runtime instead of evalPureUnison#6169
test command to use the sandboxed runtime instead of evalPureUnison#6169Conversation
|
Nice! @ceedubs this actually means we can have a single list of tests in |
|
Tweaked the transcript to use a |
I think that to make CI happy we'd need to wait until this actually makes it into a release and not just merged to |
|
Fixes #4904 |
This PR reworks a few things to improve the behavior of tests. Currently, tests run via
evalPureUnison, which surrounds the term with a sandboxing check, looking for any reference to a disallowed term (exceptDebug.toTextandValue.value, which is enables). If the check fails, a fairly opaque message is printed out. You can end up in this situation becausetestruns things this way, buttest>watches are relatively unrestricted. So, you can have a test that appears to be fine during creation, but will fail due to sandboxing later.This instead changes
testto use the sandboxed runtime, with no up front check. This has sensitive operations replaced to throw exceptions, so it's still not possible to use them. But, the error messages will be more targeted (mentioning the disallowed operation), and it won't fail merely because a disallowed operation is referred to, only if it's actually run. E.G. the following would previously fail as a test:But won't anymore, because
printLineisn't actually called with enough arguments.I also made the following adjustments to the sandboxed runtime
Debug.tracea no-op when running in sandboxed mode, instead of throwing an exception. This means that if you forget a trace statement in a test, it just won't do anything, instead of causing a failing test.Debug.toTextin the sandboxed runtime. This was enabled by tests previously.Value.valuewas already allowed in the sandboxed runtime.Addresses #4685. I thought there was another issue asking for either
traceortoTextin docs, which this would also allow (with no-op behavior for the former), but I can't seem to find it.