mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.16k stars 338 forks source link

Randomise not found name in tests #741

Closed stoovon closed 2 years ago

stoovon commented 2 years ago

Fixes https://github.com/mvdan/sh/issues/738.

mvdan commented 2 years ago

Note that this test case can fail in both TestRunnerRun and TestRunnerRunConfirm, and you've just fixing the latter.

A simpler approach might be to use a static string that's much more likely to be unique, like interp_does_not_exist. A random number might be more resilient, but it would also make our test runner more complicated, and I don't think it's worth the effort. We just need to avoid short and possibly-defined names like foo.

mvdan commented 2 years ago

Friendly ping @stoovon :)

stoovon commented 2 years ago

Thanks! Will take a look

stoovon commented 2 years ago

Closing and re-opening under https://github.com/mvdan/sh/pull/821.