Load campaign and session imports from their sources
This commit is contained in:
@@ -90,7 +90,7 @@ func TestCampaignStrictDecodeAcceptsSessionTemplateFile(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("LoadWithSessionOptions() error = %v", err)
|
||||
}
|
||||
if cfg.Campaign.SessionTemplateFile != "./session.template.yml" {
|
||||
if cfg.Campaign.SessionTemplateFile != filepath.Join(filepath.Dir(campaignPath), "session.template.yml") {
|
||||
t.Fatalf("SessionTemplateFile = %q, want ./session.template.yml", cfg.Campaign.SessionTemplateFile)
|
||||
}
|
||||
}
|
||||
@@ -173,8 +173,8 @@ func TestCampaignSessionMergeSpellCatalog(t *testing.T) {
|
||||
wantConfigPath = sessionPath
|
||||
}
|
||||
assertResolvedStableInput(t, cfg.StableInputs.SpellCatalogFile, tt.wantPath, wantConfigPath, tt.wantSource)
|
||||
if cfg.Session.Inputs.SpellCatalogFile != tt.wantPath {
|
||||
t.Fatalf("session spell_catalog_file = %q, want %q", cfg.Session.Inputs.SpellCatalogFile, tt.wantPath)
|
||||
if cfg.Session.Inputs.SpellCatalogFile != cfg.StableInputs.SpellCatalogFile.Path {
|
||||
t.Fatalf("session spell_catalog_file = %q, want %q", cfg.Session.Inputs.SpellCatalogFile, cfg.StableInputs.SpellCatalogFile.Path)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -275,6 +275,9 @@ func writeCampaignConfigTestFiles(t *testing.T, campaignYAML, sessionYAML string
|
||||
|
||||
func assertResolvedStableInput(t *testing.T, got ResolvedInputFile, wantPath, wantConfigPath, wantSource string) {
|
||||
t.Helper()
|
||||
if wantPath != "" && !filepath.IsAbs(wantPath) {
|
||||
wantPath = filepath.Join(filepath.Dir(wantConfigPath), wantPath)
|
||||
}
|
||||
if got.Path != wantPath || got.ConfigPath != wantConfigPath || got.Source != wantSource {
|
||||
t.Fatalf("resolved input = %#v, want path=%q config_path=%q source=%q", got, wantPath, wantConfigPath, wantSource)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user