package parse import "testing" func TestValue(t *testing.T) { for _, test := range []parseTest{ {`x=`, `{}`, `unexpected end of file (expected a value) at line 1, column 3`}, {`x="basic s\tring value"`, `{"x": "basic s\tring value"}`, ``}, {`x='literal s\tring value'`, `{"x": "literal s\\tring value"}`, ``}, {"x=\"\"\"basic multi-line\nstring value\"\"\"", `{"x": "basic multi-line\nstring value"}`, ``}, {"x='''literal multi-line\nstring value'''", `{"x": "literal multi-line\nstring value"}`, ``}, {"x=true", `{"x": true}`, ``}, {"x=false", `{"x": false}`, ``}, {"x=0", `{"x": 0}`, ``}, {"x=+0", `{"x": 0}`, ``}, {"x=-0", `{"x": 0}`, ``}, {"x=0.0", `{"x": 0}`, ``}, {"x=+0.0", `{"x": 0}`, ``}, {"x=-0.0", `{"x": -0}`, ``}, {"x=1234", `{"x": 1234}`, ``}, {"x=-1234", `{"x": -1234}`, ``}, {"x=+9_8_7.6_5_4e-321", `{"x": 9.8765e-319}`, ``}, {"x=-1_234.5678e-33", `{"x": -1.2345678e-30}`, ``}, {"x=inf", `{"x": +Inf}`, ``}, {"x=+inf", `{"x": +Inf}`, ``}, {"x=-inf", `{"x": -Inf}`, ``}, {"x=nan", `{"x": NaN}`, ``}, {"x=+nan", `{"x": NaN}`, ``}, {"x=-nan", `{"x": NaN}`, ``}, {"x=2019-06-19", `{"x": 2019-06-19}`, ``}, {"x=08:38:54", `{"x": 08:38:54}`, ``}, {"x=08:38:54.8765487654876", `{"x": 08:38:54.876548765}`, ``}, {"x=2019-06-19 08:38:54", `{"x": 2019-06-19 08:38:54}`, ``}, {"x=2019-06-19T08:38:54", `{"x": 2019-06-19 08:38:54}`, ``}, {"x=2019-06-19T08:38:54.88888", `{"x": 2019-06-19 08:38:54.88888}`, ``}, {"x=1979-05-27T07:32:00Z", `{"x": 1979-05-27T07:32:00Z}`, ``}, {"x=1979-05-27T00:32:00-07:00", `{"x": 1979-05-27T00:32:00-07:00}`, ``}, {"x=1979-05-27T00:32:00.999999-07:00", `{"x": 1979-05-27T00:32:00.999999-07:00}`, ``}, {"x=[1,2,3]", `{"x": [1, 2, 3]}`, ``}, {"x={1=1,2=2,3=3}", `{"x": {"1": 1, "2": 2, "3": 3}}`, ``}, } { p := newParser() testParse(t, p, p.startDocument, test) } }