From fa6a31e0812c9c062852fbcb34447f2b9e26126d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 24 Oct 2023 22:37:15 +0100 Subject: [PATCH] testscript: add TestScript.Name 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. --- testscript/testscript.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testscript/testscript.go b/testscript/testscript.go index 20b6e1f2..089e1038 100644 --- a/testscript/testscript.go +++ b/testscript/testscript.go @@ -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 {