Exemple #1
0
func BenchmarkParseBytes(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_, err := forge.ParseBytes(exampleConfigBytes)
		if err != nil {
			b.Fatal(err)
		}
	}
}
Exemple #2
0
func TestParseBytes(t *testing.T) {
	settings, err := forge.ParseBytes(testConfigBytes)
	if err != nil {
		t.Fatal(err)
	}

	values := settings.ToMap()
	assertDirectives(values, t)
}
Exemple #3
0
func ExampleParseBytes() {
	// Parse a `SectionValue` from []byte containing the config
	data := []byte("amount = 500;")
	settings, err := forge.ParseBytes(data)
	if err != nil {
		panic(err)
	}

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