func TestParseReader(t *testing.T) { settings, err := forge.ParseReader(testConfigReader) if err != nil { t.Fatal(err) } values := settings.ToMap() assertDirectives(values, t) }
func BenchmarkParseReader(b *testing.B) { for i := 0; i < b.N; i++ { exampleConfigReader.Seek(0, 0) _, err := forge.ParseReader(exampleConfigReader) if err != nil { b.Fatal(err) } } }
func ExampleParseReader() { // Parse a `SectionValue` from []byte containing the config data := []byte("amount = 500;") reader := bytes.NewBuffer(data) settings, err := forge.ParseReader(reader) if err != nil { panic(err) } fmt.Println(settings.GetInteger("amount")) }