* Disconnect package godoc comment from imported file

* Add missing newline in toml.abnf

* Tag testing helper funcs
This commit is contained in:
Cameron Moore
2021-04-15 15:49:19 -05:00
committed by GitHub
parent 24b62ebe61
commit a7b50eb8f1
4 changed files with 23 additions and 11 deletions
+1
View File
@@ -23,6 +23,7 @@
//
// Because they lack location information, these types do not represent unique
// moments or intervals of time. Use time.Time for that purpose.
package toml
import (
+7 -3
View File
@@ -155,12 +155,14 @@ func TestParser_AST_Numbers(t *testing.T) {
}
}
type astRoot []astNode
type astNode struct {
type (
astRoot []astNode
astNode struct {
Kind ast.Kind
Data []byte
Children []astNode
}
}
)
func compareAST(t *testing.T, expected astRoot, actual *ast.Root) {
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) {
t.Helper()
require.Equal(t, e.Kind, n.Kind)
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) {
t.Helper()
idx := 0
for actual.Next() {
+1
View File
@@ -59,6 +59,7 @@ val = string / boolean / array / inline-table / date-time / float / integer
;; String
string = ml-basic-string / basic-string / ml-literal-string / literal-string
;; Basic String
basic-string = quotation-mark *basic-char quotation-mark
+11 -5
View File
@@ -132,6 +132,7 @@ func TestUnmarshal_Floats(t *testing.T) {
desc: "nan",
input: `nan`,
testFn: func(t *testing.T, v float64) {
t.Helper()
assert.True(t, math.IsNaN(v))
},
},
@@ -139,6 +140,7 @@ func TestUnmarshal_Floats(t *testing.T) {
desc: "nan negative",
input: `-nan`,
testFn: func(t *testing.T, v float64) {
t.Helper()
assert.True(t, math.IsNaN(v))
},
},
@@ -146,6 +148,7 @@ func TestUnmarshal_Floats(t *testing.T) {
desc: "nan positive",
input: `+nan`,
testFn: func(t *testing.T, v float64) {
t.Helper()
assert.True(t, math.IsNaN(v))
},
},
@@ -759,8 +762,10 @@ func TestIssue484(t *testing.T) {
}, cfg)
}
type Map458 map[string]interface{}
type Slice458 []interface{}
type (
Map458 map[string]interface{}
Slice458 []interface{}
)
func (m Map458) A(s string) Slice458 {
return m[s].([]interface{})
@@ -779,7 +784,8 @@ version = "0.1.0"`)
map[string]interface{}{
"dependencies": []interface{}{"regex"},
"name": "decode",
"version": "0.1.0"},
"version": "0.1.0",
},
}
assert.Equal(t, expected, a)
}
@@ -790,7 +796,7 @@ func TestIssue252(t *testing.T) {
Val2 string `toml:"val2"`
}
var configFile = []byte(
configFile := []byte(
`
val1 = "test1"
`)
@@ -940,7 +946,7 @@ func TestIssue508(t *testing.T) {
head
}
var b = []byte(`title = "This is a title"`)
b := []byte(`title = "This is a title"`)
t1 := text{}
err := toml.Unmarshal(b, &t1)