carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package main
2
3import "testing"
4
5// CARLOS_REGION_HA reaches Config.RegionHA through regionHAEnabled
6// (strconv.ParseBool): only a true value turns the console's create-time
7// chooser on; unset, false and garbage leave create as today.
8func TestRegionHAEnabledParsesTheSwitch(t *testing.T) {
9 for v, want := range map[string]bool{"": false, "0": false, "false": false, "no": false, "garbage": false,
10 "1": true, "t": true, "true": true, "TRUE": true, " true ": true} {
11 got := regionHAEnabled(func(k string) string {
12 if k != "CARLOS_REGION_HA" {
13 t.Fatalf("read %s", k)
14 }
15 return v
16 })
17 if got != want {
18 t.Errorf("CARLOS_REGION_HA=%q: %v, want %v", v, got, want)
19 }
20 }
21}
22