Esempio n. 1
0
func Test_Create(t *testing.T) {
	config := cfg.NewConfig()

	golden := getGolden("create.cfg", t)

	config.SetString("foo", "bar")

	if config.String() != golden {
		t.Errorf("Expected %q got %q\n", golden, config.String())
	}
}
Esempio n. 2
0
func Test_WriteNewlines(t *testing.T) {
	config := cfg.NewConfig()

	b, err := ioutil.ReadFile("_testdata/write_newlines.txt")
	if err != nil {
		t.Errorf("Error opening test data: %s\n", err)
	}
	str := strings.TrimSpace(string(b))

	golden := getGolden("write_newlines.cfg", t)

	config.SetString("foo", str)

	if config.String() != golden {
		t.Errorf("Expected %q got %q\n", golden, config.String())
	}
}