func TestParseString(t *testing.T) { settings, err := forge.ParseString(testConfigString) if err != nil { t.Fatal(err) } values := settings.ToMap() assertDirectives(values, t) }
func BenchmarkParseString(b *testing.B) { for i := 0; i < b.N; i++ { _, err := forge.ParseString(exampleConfigString) if err != nil { b.Fatal(err) } } }
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")) }