internal/rosa: export preset bounds
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m48s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 4m58s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m27s
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m47s
Test / Hakurei (push) Successful in 3m48s
Test / ShareFS (push) Successful in 3m49s
Test / Sandbox (race detector) (push) Successful in 4m58s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Flake checks (push) Successful in 1m27s
These are useful for external tooling. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -120,8 +120,8 @@ const (
|
|||||||
Zlib
|
Zlib
|
||||||
Zstd
|
Zstd
|
||||||
|
|
||||||
// _presetUnexportedStart is the first unexported preset.
|
// PresetUnexportedStart is the first unexported preset.
|
||||||
_presetUnexportedStart
|
PresetUnexportedStart
|
||||||
|
|
||||||
buildcatrust = iota - 1
|
buildcatrust = iota - 1
|
||||||
utilMacros
|
utilMacros
|
||||||
@@ -137,8 +137,8 @@ const (
|
|||||||
// part of the [Std] toolchain.
|
// part of the [Std] toolchain.
|
||||||
Stage0
|
Stage0
|
||||||
|
|
||||||
// _presetEnd is the total number of presets and does not denote a preset.
|
// PresetEnd is the total number of presets and does not denote a preset.
|
||||||
_presetEnd
|
PresetEnd
|
||||||
)
|
)
|
||||||
|
|
||||||
// Metadata is stage-agnostic information of a [PArtifact] not directly
|
// Metadata is stage-agnostic information of a [PArtifact] not directly
|
||||||
@@ -159,7 +159,7 @@ const Unversioned = "\x00"
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// artifactsM is an array of [PArtifact] metadata.
|
// artifactsM is an array of [PArtifact] metadata.
|
||||||
artifactsM [_presetEnd]Metadata
|
artifactsM [PresetEnd]Metadata
|
||||||
|
|
||||||
// artifacts stores the result of Metadata.f.
|
// artifacts stores the result of Metadata.f.
|
||||||
artifacts [_toolchainEnd][len(artifactsM)]pkg.Artifact
|
artifacts [_toolchainEnd][len(artifactsM)]pkg.Artifact
|
||||||
@@ -190,7 +190,7 @@ func (t Toolchain) Version(p PArtifact) string {
|
|||||||
|
|
||||||
// ResolveName returns a [PArtifact] by name.
|
// ResolveName returns a [PArtifact] by name.
|
||||||
func ResolveName(name string) (p PArtifact, ok bool) {
|
func ResolveName(name string) (p PArtifact, ok bool) {
|
||||||
for i := range _presetUnexportedStart {
|
for i := range PresetUnexportedStart {
|
||||||
if name == artifactsM[i].Name {
|
if name == artifactsM[i].Name {
|
||||||
return i, true
|
return i, true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package rosa
|
package rosa_test
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
// PresetEnd is the total PArtifact count exported for testing.
|
"hakurei.app/internal/rosa"
|
||||||
const PresetEnd = _presetEnd
|
)
|
||||||
|
|
||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for i := range _presetEnd {
|
for i := range rosa.PresetEnd {
|
||||||
p := PArtifact(i)
|
p := rosa.PArtifact(i)
|
||||||
t.Run(GetMetadata(p).Name, func(t *testing.T) {
|
t.Run(rosa.GetMetadata(p).Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
Std.Load(p)
|
rosa.Std.Load(p)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,13 +22,13 @@ func TestLoad(t *testing.T) {
|
|||||||
func TestResolveName(t *testing.T) {
|
func TestResolveName(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for i := range _presetUnexportedStart {
|
for i := range rosa.PresetUnexportedStart {
|
||||||
p := i
|
p := i
|
||||||
name := GetMetadata(p).Name
|
name := rosa.GetMetadata(p).Name
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if got, ok := ResolveName(name); !ok {
|
if got, ok := rosa.ResolveName(name); !ok {
|
||||||
t.Fatal("ResolveName: ok = false")
|
t.Fatal("ResolveName: ok = false")
|
||||||
} else if got != p {
|
} else if got != p {
|
||||||
t.Fatalf("ResolveName: %d, want %d", got, p)
|
t.Fatalf("ResolveName: %d, want %d", got, p)
|
||||||
@@ -38,13 +39,13 @@ func TestResolveName(t *testing.T) {
|
|||||||
func TestResolveNameUnexported(t *testing.T) {
|
func TestResolveNameUnexported(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for i := _presetUnexportedStart; i < _presetEnd; i++ {
|
for i := rosa.PresetUnexportedStart; i < rosa.PresetEnd; i++ {
|
||||||
p := i
|
p := i
|
||||||
name := GetMetadata(p).Name
|
name := rosa.GetMetadata(p).Name
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if got, ok := ResolveName(name); ok {
|
if got, ok := rosa.ResolveName(name); ok {
|
||||||
t.Fatalf("ResolveName: resolved unexported preset %d", got)
|
t.Fatalf("ResolveName: resolved unexported preset %d", got)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user