(t *testing.T)
| 498 | } |
| 499 | |
| 500 | func TestResolveOutputLocationUsesRuntimeConfig(t *testing.T) { |
| 501 | t.Setenv("GOG_TIMEZONE", "") |
| 502 | |
| 503 | ambientLayout := config.Layout{ConfigDir: t.TempDir(), ExplicitConfig: true} |
| 504 | if err := config.NewConfigStore(ambientLayout).Write(config.File{DefaultTimezone: "UTC"}); err != nil { |
| 505 | t.Fatalf("write ambient config: %v", err) |
| 506 | } |
| 507 | t.Setenv("GOG_CONFIG_DIR", ambientLayout.ConfigDir) |
| 508 | |
| 509 | runtimeLayout := config.Layout{ConfigDir: t.TempDir(), ExplicitConfig: true} |
| 510 | runtimeStore := config.NewConfigStore(runtimeLayout) |
| 511 | if err := runtimeStore.Write(config.File{DefaultTimezone: "Europe/London"}); err != nil { |
| 512 | t.Fatalf("write runtime config: %v", err) |
| 513 | } |
| 514 | ctx := app.WithRuntime(context.Background(), &app.Runtime{ |
| 515 | Layout: runtimeLayout, |
| 516 | Config: runtimeStore, |
| 517 | }) |
| 518 | |
| 519 | loc, err := resolveOutputLocation(ctx, "", false, io.Discard) |
| 520 | if err != nil { |
| 521 | t.Fatalf("resolveOutputLocation: %v", err) |
| 522 | } |
| 523 | if got := loc.String(); got != "Europe/London" { |
| 524 | t.Fatalf("location = %q, want Europe/London", got) |
| 525 | } |
| 526 | } |
nothing calls this directly
no test coverage detected