carlos / platform Public

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

Plain git — no account needed to clone.

Download

Download this file

1package appconfig
2
3import "testing"
4
5func TestApplyAgentVars(t *testing.T) {
6 in := []byte("A=1\nCARLOS_PURGE=socket\nB=2\nCARLOS_CONTROL_SOCKET=/tmp/x\n")
7 got := string(applyAgentVars(in))
8 want := "A=1\nB=2\nCARLOS_PURGE=header\n"
9 if got != want {
10 t.Fatalf("got %q want %q", got, want)
11 }
12 if again := string(applyAgentVars([]byte(got))); again != want {
13 t.Fatalf("not idempotent: %q", again)
14 }
15 if got := string(applyAgentVars(nil)); got != "CARLOS_PURGE=header\n" {
16 t.Fatalf("empty render: got %q", got)
17 }
18}
19