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
5func TestHostClaimEnabled(t *testing.T) {
6 for _, v := range []string{"", " ", "\t\n", "1", "true", "0", "on", " true "} {
7 calls := 0
8 got := hostClaimEnabled(func(k string) string {
9 calls++
10 if k != "CARLOS_HOST_CLAIM" {
11 t.Fatal(k)
12 }
13 return v
14 })
15 want := v != "" && v != " " && v != "\t\n"
16 if got != want || calls != 1 {
17 t.Fatalf("%q: %v calls %d", v, got, calls)
18 }
19 }
20}
21