go-toml/parse/parse_test.go

24 lines
580 B
Go

package parse_test
import (
"fmt"
"git.makaay.nl/mauricem/go-toml/parse"
)
func ExampleRun() {
doc, err := parse.Run("key = 'value' key2 = 'another value'")
fmt.Println(doc, err)
doc, err = parse.Run("key = 'value'\n[table]\nanother_key = 'another one'")
fmt.Println(doc, err)
doc, err = parse.Run("key1 = 'valid' key2 = invalid")
fmt.Println(doc, err)
// Output:
// {"key": "value", "key2": "another value"} <nil>
// {"key": "value", "table": {"another_key": "another one"}} <nil>
// {"key1": "valid"} unexpected input (expected a value) at line 1, column 23
}