package main import "testing" // CARLOS_REGION_HA reaches Config.RegionHA through regionHAEnabled // (strconv.ParseBool): only a true value turns the console's create-time // chooser on; unset, false and garbage leave create as today. func TestRegionHAEnabledParsesTheSwitch(t *testing.T) { for v, want := range map[string]bool{"": false, "0": false, "false": false, "no": false, "garbage": false, "1": true, "t": true, "true": true, "TRUE": true, " true ": true} { got := regionHAEnabled(func(k string) string { if k != "CARLOS_REGION_HA" { t.Fatalf("read %s", k) } return v }) if got != want { t.Errorf("CARLOS_REGION_HA=%q: %v, want %v", v, got, want) } } }