Skip to content

Commit

Permalink
testscript: add TestScript.Name
Browse files Browse the repository at this point in the history
This will be useful in some cmd/cue test scripts
where we want each test to create a unique remote resource
that includes the current test name as a prefix,
for the sake of more easily seeing which test created which resource.
  • Loading branch information
mvdan committed Oct 26, 2023
1 parent 0bcf77f commit fa6a31e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions testscript/testscript.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ func writeFile(name string, data []byte, perm fs.FileMode, excl bool) error {
return nil
}

// Name returns the short name or basename of the test script.
func (ts *TestScript) Name() string { return ts.name }

// setup sets up the test execution temporary directory and environment.
// It returns the comment section of the txtar archive.
func (ts *TestScript) setup() string {
Expand Down

0 comments on commit fa6a31e

Please sign in to comment.