예제 #1
0
func TestParseString(t *testing.T) {
	settings, err := forge.ParseString(testConfigString)
	if err != nil {
		t.Fatal(err)
	}
	values := settings.ToMap()
	assertDirectives(values, t)
}
예제 #2
0
func BenchmarkParseString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_, err := forge.ParseString(exampleConfigString)
		if err != nil {
			b.Fatal(err)
		}
	}
}
예제 #3
0
func ExampleParseString() {
	// Parse a `SectionValue` from string containing the config
	data := "amount = 500;"
	settings, err := forge.ParseString(data)
	if err != nil {
		panic(err)
	}

	fmt.Println(settings.GetInteger("amount"))
}