Fix typos in comments and tests (#972)

This commit is contained in:
Oleksandr Redko
2024-11-16 18:30:13 +02:00
committed by GitHub
parent af236b689f
commit 923b2ab478
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ func rmTag(typedJson interface{}) (interface{}, error) {
} }
return m, nil return m, nil
// Array: remove tags from all itenm. // Array: remove tags from all items.
case []interface{}: case []interface{}:
a := make([]interface{}, len(v)) a := make([]interface{}, len(v))
for i := range v { for i := range v {
+7 -7
View File
@@ -1280,7 +1280,7 @@ randomize = true
require.Equal(t, expected, buf.String()) require.Equal(t, expected, buf.String())
} }
func TestMarhsalIssue888(t *testing.T) { func TestMarshalIssue888(t *testing.T) {
type Thing struct { type Thing struct {
FieldA string `comment:"my field A"` FieldA string `comment:"my field A"`
FieldB string `comment:"my field B"` FieldB string `comment:"my field B"`
@@ -1629,15 +1629,15 @@ func ExampleMarshal_commented() {
} }
type Costs struct { type Costs struct {
Cost *int `toml:"cost" comment:"default cost (for wildcarded equalence or matched with regex, or if no value cost set)"` Cost *int `toml:"cost" comment:"default cost (for wildcarded equivalence or matched with regex, or if no value cost set)"`
ValuesCost map[string]int `toml:"values-cost" comment:"cost with some value (for equalence without wildcards) (additional tuning, usually not needed)"` ValuesCost map[string]int `toml:"values-cost" comment:"cost with some value (for equivalence without wildcards) (additional tuning, usually not needed)"`
} }
type ClickHouse struct { type ClickHouse struct {
URL string `toml:"url" comment:"default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params"` URL string `toml:"url" comment:"default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params"`
RenderMaxQueries int `toml:"render-max-queries" comment:"Max queries to render queiries"` RenderMaxQueries int `toml:"render-max-queries" comment:"Max queries to render queries"`
RenderConcurrentQueries int `toml:"render-concurrent-queries" comment:"Concurrent queries to render queiries"` RenderConcurrentQueries int `toml:"render-concurrent-queries" comment:"Concurrent queries to render queries"`
TaggedCosts map[string]*Costs `toml:"tagged-costs,commented"` TaggedCosts map[string]*Costs `toml:"tagged-costs,commented"`
TreeTable string `toml:"tree-table,commented"` TreeTable string `toml:"tree-table,commented"`
ReverseTreeTable string `toml:"reverse-tree-table,commented"` ReverseTreeTable string `toml:"reverse-tree-table,commented"`
@@ -1711,9 +1711,9 @@ func ExampleMarshal_commented() {
// [clickhouse] // [clickhouse]
// # default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params // # default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params
// url = 'http://localhost:8123?cancel_http_readonly_queries_on_client_close=1' // url = 'http://localhost:8123?cancel_http_readonly_queries_on_client_close=1'
// # Max queries to render queiries // # Max queries to render queries
// render-max-queries = 0 // render-max-queries = 0
// # Concurrent queries to render queiries // # Concurrent queries to render queries
// render-concurrent-queries = 0 // render-concurrent-queries = 0
// # tree-table = '' // # tree-table = ''
// # reverse-tree-table = '' // # reverse-tree-table = ''
+1 -1
View File
@@ -1804,7 +1804,7 @@ func TestTOMLTest_Valid_Array_Empty(t *testing.T) {
testgenValid(t, input, jsonRef) testgenValid(t, input, jsonRef)
} }
func TestTOMLTest_Valid_Array_Hetergeneous(t *testing.T) { func TestTOMLTest_Valid_Array_Heterogeneous(t *testing.T) {
input := "mixed = [[1, 2], [\"a\", \"b\"], [1.1, 2.1]]\n" input := "mixed = [[1, 2], [\"a\", \"b\"], [1.1, 2.1]]\n"
jsonRef := "{\n \"mixed\": [\n [\n {\n \"type\": \"integer\",\n \"value\": \"1\"\n },\n {\n \"type\": \"integer\",\n \"value\": \"2\"\n }\n ],\n [\n {\n \"type\": \"string\",\n \"value\": \"a\"\n },\n {\n \"type\": \"string\",\n \"value\": \"b\"\n }\n ],\n [\n {\n \"type\": \"float\",\n \"value\": \"1.1\"\n },\n {\n \"type\": \"float\",\n \"value\": \"2.1\"\n }\n ]\n ]\n}\n" jsonRef := "{\n \"mixed\": [\n [\n {\n \"type\": \"integer\",\n \"value\": \"1\"\n },\n {\n \"type\": \"integer\",\n \"value\": \"2\"\n }\n ],\n [\n {\n \"type\": \"string\",\n \"value\": \"a\"\n },\n {\n \"type\": \"string\",\n \"value\": \"b\"\n }\n ],\n [\n {\n \"type\": \"float\",\n \"value\": \"1.1\"\n },\n {\n \"type\": \"float\",\n \"value\": \"2.1\"\n }\n ]\n ]\n}\n"
testgenValid(t, input, jsonRef) testgenValid(t, input, jsonRef)
+1 -1
View File
@@ -59,7 +59,7 @@ func (d *Decoder) DisallowUnknownFields() *Decoder {
// //
// With this feature enabled, types implementing the unstable/Unmarshaler // With this feature enabled, types implementing the unstable/Unmarshaler
// interface can be decoded from any structure of the document. It allows types // interface can be decoded from any structure of the document. It allows types
// that don't have a straightfoward TOML representation to provide their own // that don't have a straightforward TOML representation to provide their own
// decoding logic. // decoding logic.
// //
// Currently, types can only decode from a single value. Tables and array tables // Currently, types can only decode from a single value. Tables and array tables