Additional formatting
This commit is contained in:
+19
-20
@@ -158,7 +158,6 @@ func TestNestedEmptyArrays(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func TestArrayMixedTypes(t *testing.T) {
|
||||
_, err := Load("a = [42, 16.0]")
|
||||
if err.Error() != "mixed types in array" {
|
||||
@@ -291,31 +290,31 @@ func TestParseFile(t *testing.T) {
|
||||
func TestParseKeyGroupArray(t *testing.T) {
|
||||
tree, err := Load("[[foo.bar]] a = 42\n[[foo.bar]] a = 69")
|
||||
assertTree(t, tree, err, map[string]interface{}{
|
||||
"foo": map[string]interface{} {
|
||||
"bar": []map[string]interface{} {
|
||||
{ "a": int64(42), },
|
||||
{ "a": int64(69), },
|
||||
"foo": map[string]interface{}{
|
||||
"bar": []map[string]interface{}{
|
||||
{"a": int64(42)},
|
||||
{"a": int64(69)},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestToTomlValue(t *testing.T) {
|
||||
for idx, item := range []struct{
|
||||
for idx, item := range []struct {
|
||||
Value interface{}
|
||||
Expect string
|
||||
}{
|
||||
{ int64(12345), "12345", },
|
||||
{ float64(123.45), "123.45", },
|
||||
{ bool(true), "true", },
|
||||
{ "hello world", "\"hello world\"", },
|
||||
{ "\b\t\n\f\r\"\\", "\"\\b\\t\\n\\f\\r\\\"\\\\\"", },
|
||||
{ "\x05", "\"\\u0005\"", },
|
||||
{ time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
|
||||
"1979-05-27T07:32:00Z", },
|
||||
{ []interface{}{"gamma", "delta"},
|
||||
"[\n \"gamma\",\n \"delta\",\n]", },
|
||||
}{
|
||||
{int64(12345), "12345"},
|
||||
{float64(123.45), "123.45"},
|
||||
{bool(true), "true"},
|
||||
{"hello world", "\"hello world\""},
|
||||
{"\b\t\n\f\r\"\\", "\"\\b\\t\\n\\f\\r\\\"\\\\\""},
|
||||
{"\x05", "\"\\u0005\""},
|
||||
{time.Date(1979, time.May, 27, 7, 32, 0, 0, time.UTC),
|
||||
"1979-05-27T07:32:00Z"},
|
||||
{[]interface{}{"gamma", "delta"},
|
||||
"[\n \"gamma\",\n \"delta\",\n]"},
|
||||
} {
|
||||
result := toTomlValue(item.Value, 0)
|
||||
if result != item.Expect {
|
||||
t.Errorf("Test %d - got '%s', expected '%s'", idx, result, item.Expect)
|
||||
@@ -326,9 +325,9 @@ func TestToTomlValue(t *testing.T) {
|
||||
func TestToString(t *testing.T) {
|
||||
tree := &TomlTree{
|
||||
"foo": &TomlTree{
|
||||
"bar": []*TomlTree {
|
||||
{ "a": int64(42), },
|
||||
{ "a": int64(69), },
|
||||
"bar": []*TomlTree{
|
||||
{"a": int64(42)},
|
||||
{"a": int64(69)},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user