package config import "testing" func TestEscape (test *testing.T) { expected := `\\\a\bhello\t\n\vworld!\f\r\"` got := escape("\\\a\bhello\t\n\vworld!\f\r\"") if got != expected { test.Fatalf("expected: [%s]\ngot:[%s]", expected, got) } } func TestUnescape (test *testing.T) { expected := "\\\a\bhello\t\n\vworld!\f\r\"" got, ok := unescape(`\\\a\bhello\t\n\vworld!\f\r\"`) if !ok { test.Fatalf("text could not be unescaped") } if got != expected { test.Fatalf("expected: [%s]\ngot:[%s]", expected, got) } }