diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-21 23:06:34 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-21 23:06:34 +0900 |
| commit | 68a91523b9e58ee8a9f86723d616e82c0645b64a (patch) | |
| tree | a16f116b6b606d50bd2e887a173b981552ca0eb0 /internal/rosa/builtins.go | |
| parent | 564732162223e76a307bb06e132e9f0351f239bf (diff) | |
internal/rosa/package: migrate bison
This is the final remaining trivial legacy artifact.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/builtins.go')
| -rw-r--r-- | internal/rosa/builtins.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/rosa/builtins.go b/internal/rosa/builtins.go index 78123921..b0ec65b1 100644 --- a/internal/rosa/builtins.go +++ b/internal/rosa/builtins.go @@ -2,6 +2,8 @@ package rosa import ( "path" + "slices" + "strconv" "strings" "hakurei.app/internal/pkg" @@ -68,3 +70,37 @@ func newFromGitHubRelease( compression, ) } + +// skipGNUTests generates a string for skipping specific tests by number in a +// GNU test suite. This is nontrivial because the test suite does not support +// excluding tests in any way, so ranges for all but the skipped tests have to +// be specified instead. +// +// For example, to skip test 764, ranges around the skipped test must be +// specified: +// +// 1-763 765- +// +// Tests are numbered starting from 1. The resulting string is unquoted. +func skipGNUTests(tests ...int64) string { + tests = slices.Clone(tests) + slices.Sort(tests) + + var buf strings.Builder + + if tests[0] != 1 { + buf.WriteString("1-") + } + + for i, n := range tests { + if n != 1 && (i == 0 || tests[i-1] != n-1) { + buf.WriteString(strconv.Itoa(int(n - 1))) + buf.WriteString(" ") + } + if i == len(tests)-1 || tests[i+1] != n+1 { + buf.WriteString(strconv.Itoa(int(n + 1))) + buf.WriteString("-") + } + } + return buf.String() +} |
