You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the record, the way that the Go implementation does this is by associating each testscript command with some metadata. This metadata includes information about which arguments are regular expressions.
This information is needed because the commands themselves are not responsible for expanding variable references, so cannot know which parts of an argument have come from an environment variable (and hence need to be quoted) and which have not.
In order to fix this, ISTM we would need a differently typed map for commands. Currently the map is of type map[string]func(ts *TestScript, neg bool, args []string) but that does not provide any space for added metadata.
Note that also, this would technically be a breaking change. Currently the following test passes, but would fail if variable references were to be automatically escaped:
For now, there is a workaround: testscript provides the ability to escape regexp characters by using the @R modifier. This variant of the original example test passes, for instance:
As of c8567cf , the following (which can be used as a testscript test for
testscript
itself) fails when it should succeed:The output is:
Upstream Go succeeds with this test (as of golang/go@9b43bfb).
The text was updated successfully, but these errors were encountered: