Closed rudifa closed 3 months ago
Sure - you can already do this yourself by adding custom conditions. I don't believe this needs to be part of testscript itself, and I think users might want different behavior in terms of how to convert an env var string to a boolean. Some users might want to support just 1
, others https://pkg.go.dev/strconv#ParseBool, others "is not empty", or others even "is set" like in https://pkg.go.dev/os#LookupEnv.
I agree that it can be useful, but it's pretty easy to write your own conditional function, and you then get to choose exactly what boolean logic you want, so I think that's the best approach.
In a txtar script I want to be able to use environment variables to condition the test step execution, like this
Motivation:
In a script like this one I can collect a number of related test cases (a cue input, a current possibly buggy output of
cue fmt
, a dump of the ast, e.t.c.):Now I want to prefix some of the test steps with custom conditions
This would let me run the same script at different times with different purposes, while having similar test cases with their related data (in, got, ast, ...) all in one script, e.g.:
The new feature would be documented like this:
Comments on the proposed feature are invited.