command and help ux pass (#21)
Reviewed-on: #21 Co-authored-by: vickydotbat <vickydotbat@tutamail.com> Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #21.
This commit is contained in:
@@ -384,50 +384,30 @@ func TestValidateLayoutRejectsInvalidTopDataClassFeatInjections(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanUsesYAMLMusicConvertExtensionsWithinConfiguredDatasetRoots(t *testing.T) {
|
||||
func TestDefaultAssetExtensionsKeepAuthoredBMUWithoutConversionSources(t *testing.T) {
|
||||
for _, extension := range []string{".bmu", ".wav"} {
|
||||
if !slices.Contains(AssetExtensions, extension) {
|
||||
t.Errorf("default asset extensions must retain %s", extension)
|
||||
}
|
||||
}
|
||||
for _, extension := range []string{".mp3", ".ogg"} {
|
||||
if slices.Contains(AssetExtensions, extension) {
|
||||
t.Errorf("default asset extensions must not include conversion source %s", extension)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadRejectsRemovedMusicConfig(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
if err := os.MkdirAll(filepath.Join(root, "assets", "audio", "westgate"), 0o755); err != nil {
|
||||
t.Fatalf("mkdir westgate audio: %v", err)
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Join(root, "assets", "audio", "other"), 0o755); err != nil {
|
||||
t.Fatalf("mkdir other audio: %v", err)
|
||||
}
|
||||
writeProjectFile(t, filepath.Join(root, ConfigFile), `
|
||||
module:
|
||||
name: Test Module
|
||||
resref: testmod
|
||||
paths:
|
||||
source: src
|
||||
assets: assets
|
||||
music:
|
||||
defaults:
|
||||
convert_extensions:
|
||||
- .flac
|
||||
datasets:
|
||||
westgate_audio:
|
||||
source: audio/westgate
|
||||
convert_extensions:
|
||||
- .aac
|
||||
datasets: {}
|
||||
`)
|
||||
writeProjectFile(t, filepath.Join(root, "assets", "audio", "westgate", "theme.aac"), "aac")
|
||||
writeProjectFile(t, filepath.Join(root, "assets", "audio", "westgate", "theme.flac"), "flac")
|
||||
writeProjectFile(t, filepath.Join(root, "assets", "audio", "other", "ignored.aac"), "aac")
|
||||
|
||||
proj, err := Load(root)
|
||||
if err != nil {
|
||||
t.Fatalf("Load returned error: %v", err)
|
||||
}
|
||||
if err := proj.Scan(); err != nil {
|
||||
t.Fatalf("Scan returned error: %v", err)
|
||||
}
|
||||
if !slices.Contains(proj.Inventory.AssetFiles, "audio/westgate/theme.aac") {
|
||||
t.Fatalf("expected configured dataset AAC file to be discovered, got %#v", proj.Inventory.AssetFiles)
|
||||
}
|
||||
if !slices.Contains(proj.Inventory.AssetFiles, "audio/westgate/theme.flac") {
|
||||
t.Fatalf("expected configured dataset FLAC file to be discovered, got %#v", proj.Inventory.AssetFiles)
|
||||
}
|
||||
if slices.Contains(proj.Inventory.AssetFiles, "audio/other/ignored.aac") {
|
||||
t.Fatalf("did not expect non-dataset AAC file to be discovered, got %#v", proj.Inventory.AssetFiles)
|
||||
if _, err := Load(root); err == nil || !strings.Contains(err.Error(), "music") {
|
||||
t.Fatalf("expected strict YAML decoding to reject removed music config, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1780,34 +1760,6 @@ func TestValidateLayoutRejectsDuplicateHAKNames(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateLayoutRejectsAmbiguousMusicPrefixes(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mkdirAll(t, filepath.Join(root, "assets"))
|
||||
mkdirAll(t, filepath.Join(root, "build"))
|
||||
|
||||
proj := &Project{
|
||||
Root: root,
|
||||
Config: Config{
|
||||
Module: ModuleConfig{Name: "Test", ResRef: "test"},
|
||||
Paths: PathConfig{Assets: "assets", Build: "build"},
|
||||
Music: MusicConfig{
|
||||
Prefixes: map[string]string{
|
||||
"envi/music": "mus_",
|
||||
"/envi/music": "mus2_",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := proj.ValidateLayout()
|
||||
if err == nil {
|
||||
t.Fatal("expected music prefix validation error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "normalize to the same path") {
|
||||
t.Fatalf("expected ambiguous prefix validation error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanAllowsMissingAssetsDir(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mkdirAll(t, filepath.Join(root, "src"))
|
||||
|
||||
Reference in New Issue
Block a user