Tidy (#511)
* Disconnect package godoc comment from imported file * Add missing newline in toml.abnf * Tag testing helper funcs
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
//
|
//
|
||||||
// Because they lack location information, these types do not represent unique
|
// Because they lack location information, these types do not represent unique
|
||||||
// moments or intervals of time. Use time.Time for that purpose.
|
// moments or intervals of time. Use time.Time for that purpose.
|
||||||
|
|
||||||
package toml
|
package toml
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
+10
-6
@@ -155,12 +155,14 @@ func TestParser_AST_Numbers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type astRoot []astNode
|
type (
|
||||||
type astNode struct {
|
astRoot []astNode
|
||||||
Kind ast.Kind
|
astNode struct {
|
||||||
Data []byte
|
Kind ast.Kind
|
||||||
Children []astNode
|
Data []byte
|
||||||
}
|
Children []astNode
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func compareAST(t *testing.T, expected astRoot, actual *ast.Root) {
|
func compareAST(t *testing.T, expected astRoot, actual *ast.Root) {
|
||||||
it := actual.Iterator()
|
it := actual.Iterator()
|
||||||
@@ -168,6 +170,7 @@ func compareAST(t *testing.T, expected astRoot, actual *ast.Root) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func compareNode(t *testing.T, e astNode, n ast.Node) {
|
func compareNode(t *testing.T, e astNode, n ast.Node) {
|
||||||
|
t.Helper()
|
||||||
require.Equal(t, e.Kind, n.Kind)
|
require.Equal(t, e.Kind, n.Kind)
|
||||||
require.Equal(t, e.Data, n.Data)
|
require.Equal(t, e.Data, n.Data)
|
||||||
|
|
||||||
@@ -175,6 +178,7 @@ func compareNode(t *testing.T, e astNode, n ast.Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func compareIterator(t *testing.T, expected []astNode, actual ast.Iterator) {
|
func compareIterator(t *testing.T, expected []astNode, actual ast.Iterator) {
|
||||||
|
t.Helper()
|
||||||
idx := 0
|
idx := 0
|
||||||
|
|
||||||
for actual.Next() {
|
for actual.Next() {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ val = string / boolean / array / inline-table / date-time / float / integer
|
|||||||
;; String
|
;; String
|
||||||
|
|
||||||
string = ml-basic-string / basic-string / ml-literal-string / literal-string
|
string = ml-basic-string / basic-string / ml-literal-string / literal-string
|
||||||
|
|
||||||
;; Basic String
|
;; Basic String
|
||||||
|
|
||||||
basic-string = quotation-mark *basic-char quotation-mark
|
basic-string = quotation-mark *basic-char quotation-mark
|
||||||
|
|||||||
+11
-5
@@ -132,6 +132,7 @@ func TestUnmarshal_Floats(t *testing.T) {
|
|||||||
desc: "nan",
|
desc: "nan",
|
||||||
input: `nan`,
|
input: `nan`,
|
||||||
testFn: func(t *testing.T, v float64) {
|
testFn: func(t *testing.T, v float64) {
|
||||||
|
t.Helper()
|
||||||
assert.True(t, math.IsNaN(v))
|
assert.True(t, math.IsNaN(v))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -139,6 +140,7 @@ func TestUnmarshal_Floats(t *testing.T) {
|
|||||||
desc: "nan negative",
|
desc: "nan negative",
|
||||||
input: `-nan`,
|
input: `-nan`,
|
||||||
testFn: func(t *testing.T, v float64) {
|
testFn: func(t *testing.T, v float64) {
|
||||||
|
t.Helper()
|
||||||
assert.True(t, math.IsNaN(v))
|
assert.True(t, math.IsNaN(v))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -146,6 +148,7 @@ func TestUnmarshal_Floats(t *testing.T) {
|
|||||||
desc: "nan positive",
|
desc: "nan positive",
|
||||||
input: `+nan`,
|
input: `+nan`,
|
||||||
testFn: func(t *testing.T, v float64) {
|
testFn: func(t *testing.T, v float64) {
|
||||||
|
t.Helper()
|
||||||
assert.True(t, math.IsNaN(v))
|
assert.True(t, math.IsNaN(v))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -759,8 +762,10 @@ func TestIssue484(t *testing.T) {
|
|||||||
}, cfg)
|
}, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Map458 map[string]interface{}
|
type (
|
||||||
type Slice458 []interface{}
|
Map458 map[string]interface{}
|
||||||
|
Slice458 []interface{}
|
||||||
|
)
|
||||||
|
|
||||||
func (m Map458) A(s string) Slice458 {
|
func (m Map458) A(s string) Slice458 {
|
||||||
return m[s].([]interface{})
|
return m[s].([]interface{})
|
||||||
@@ -779,7 +784,8 @@ version = "0.1.0"`)
|
|||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"dependencies": []interface{}{"regex"},
|
"dependencies": []interface{}{"regex"},
|
||||||
"name": "decode",
|
"name": "decode",
|
||||||
"version": "0.1.0"},
|
"version": "0.1.0",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
assert.Equal(t, expected, a)
|
assert.Equal(t, expected, a)
|
||||||
}
|
}
|
||||||
@@ -790,7 +796,7 @@ func TestIssue252(t *testing.T) {
|
|||||||
Val2 string `toml:"val2"`
|
Val2 string `toml:"val2"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var configFile = []byte(
|
configFile := []byte(
|
||||||
`
|
`
|
||||||
val1 = "test1"
|
val1 = "test1"
|
||||||
`)
|
`)
|
||||||
@@ -940,7 +946,7 @@ func TestIssue508(t *testing.T) {
|
|||||||
head
|
head
|
||||||
}
|
}
|
||||||
|
|
||||||
var b = []byte(`title = "This is a title"`)
|
b := []byte(`title = "This is a title"`)
|
||||||
|
|
||||||
t1 := text{}
|
t1 := text{}
|
||||||
err := toml.Unmarshal(b, &t1)
|
err := toml.Unmarshal(b, &t1)
|
||||||
|
|||||||
Reference in New Issue
Block a user