cue-unity / unity

unity - run experiments/regression tests on CUE modules
Apache License 2.0
41 stars 5 forks source link

projects: use testscript comment sections to reduce noisy output #48

Closed myitcv closed 3 years ago

myitcv commented 3 years ago

When running cue eval (which defaults to stdout) the output can be very long. One option is to have this output be directed to a file. This is somewhat less than ideal because it makes debugging that bit harder.

Other option is to use testscript comment blocks to hide that output.

testscript determines sections of commands to be a comment followed by contiguous lines of commands, e.g.

# This is a comment
exec ls

# Another comment
cmp stdout stdout.golden

Here there are two sections. If all of these commands in a section succeed according to their specification (in this case all must exit with a zero exit code) then the log output of testscript in that section will be collapsed. Hence it the exec ls command succeeds, then regardless of the result of the cmp command, the output from the exec ls section will be collapsed, and only the comment "header" for that section will be logged.