Skip to content

Commit

Permalink
internal/tdtest: mimic replacement of testing.Run in Select
Browse files Browse the repository at this point in the history
This allows the select string to be the same as the subtest name.

This is only an approximation, as testing.T.Run does more
rewriting.

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I36290242264d831b788fe9a5975210f5c1e4ba41
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1167817
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
mpvl committed Aug 24, 2023
1 parent 220b44e commit 1763cea
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions internal/tdtest/tdtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ import (
// - make name field explicit, i.e. Name("name"), field tag, or tdtest.Name type.
// - allow "skip" field. Again either SkipName("skip"), tag, or Skip type.
// - allow for tdtest:"noupdate" field tag.
// - should we derive names from field names? This would require always
// loading the packages data upon error. Could be an option to disable, or
// implicitly it would only be loaded if there is an error without message.
// - Option: allow ignore field that lists a set of fields to not be tested
// for that particular test case: ignore: tdtest.Ignore("want1", "want2")
//
Expand Down Expand Up @@ -165,6 +162,7 @@ func (t *T) Select(tests ...any) {
return
}
case string:
n = strings.ReplaceAll(n, " ", "_")
if n == parts[len(parts)-1] {
return
}
Expand Down

0 comments on commit 1763cea

Please sign in to comment.