Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: extract TestScript functionality to internal/script #29288
While writing a test for #29253, it is apparent that using the existing cmd/go script test framework makes the test writing easy and straightforward. However, I don't like the fact that a test for
I think the underlying concept of the script is very useful and enables us to write very simple single file test cases for even the most complicated scenarios.
I'd like to suggest that we move its functionality to
Also, I'd like to make it possible to run single text archive go test cases with something like:
Perhaps we could even make a
FWIW I have extracted much of the script_test.go functionality into this package. Feel free to bring some or all of it back within the Go repository. It's missing some of the pieces that I considered were go-command-specific (particularly the bits that were about compiling Go programs, which added a reasonable amount of complexity). It should be extensible enough to add that functionality back in though.
This seems OK to try in Go 1.13 provided it stays as internal/script and we don't just grow an enormous number of "commands" in the scripting language. I don't want to commit to an API for external use. I'm also worried about, for example, the "go" command in the cmd/go tests. It doesn't make sense in a general internal/script test. What commands move? What commands stay? It's unclear to me how well this will generalize. But feel free to make a concrete proposal.