Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong lines counting on Windows #44

Closed
vlastahajek opened this issue Aug 1, 2019 · 1 comment
Closed

Wrong lines counting on Windows #44

vlastahajek opened this issue Aug 1, 2019 · 1 comment

Comments

@vlastahajek
Copy link

vlastahajek commented Aug 1, 2019

Altough there are other problems on Windows resulting mainly from line ending difference (see the tests result bellow) one specific annoying issue is wrong lines counting occurring mainly in error strings, like:

       got:  line 15: key `b' is in conflict with table in line 7
       want: line 8: key `b' is in conflict with table in line 4

All tests passes on linux. But on Windows:

=== RUN   TestConfigNormField
--- PASS: TestConfigNormField (0.00s)
=== RUN   TestConfigFieldToKey
--- PASS: TestConfigFieldToKey (0.00s)
=== RUN   TestConfigMissingField
--- PASS: TestConfigMissingField (0.00s)
=== RUN   TestUnmarshal
--- FAIL: TestUnmarshal (0.00s)
    decode_test.go:321: Unmarshal value mismatch for input:
        # test.toml
        
        ################################################################################
        ## Comment
        
        # Speak your mind with the hash symbol. They go from the symbol to the end of
        # the line.
        
        
        ################################################################################
        ## Table
        
        # Tables (also known as hash tables or dictionaries) are collections of
        # key/value pairs. They appear in square brackets on a line by themselves.
        
        [table]
        
        key = "value" # Yeah, you can do this.
        
        # Nested tables are denoted by table names with dots in them. Name your tables
        # whatever crap you please, just don't use #, ., [ or ].
        
        [table.subtable]
        
        key = "another value"
        
        # You don't need to specify all the super-tables if you don't want to. TOML
        # knows how to do it for you.
        
        # [x] you
        # [x.y] don't
        # [x.y.z] need these
        [x.y.z.w] # for this to work
        
        
        ################################################################################
        ## Inline Table
        
        # Inline tables provide a more compact syntax for expressing tables. They are
        # especially useful for grouped data that can otherwise quickly become verbose.
        # Inline tables are enclosed in curly braces `{` and `}`. No newlines are
        # allowed between the curly braces unless they are valid within a value.
        
        [table.inline]
        
        name = { first = "Tom", last = "Preston-Werner" }
        point = { x = 1, y = 2 }
        
        
        ################################################################################
        ## String
        
        # There are four ways to express strings: basic, multi-line basic, literal, and
        # multi-line literal. All strings must contain only valid UTF-8 characters.
        
        [string.basic]
        
        basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
        
        [string.multiline]
        
        # The following strings are byte-for-byte equivalent:
        key1 = "One\nTwo"
        key2 = """One\nTwo"""
        key3 = """
        One
        Two"""
        
        [string.multiline.continued]
        
        # The following strings are byte-for-byte equivalent:
        key1 = "The quick brown fox jumps over the lazy dog."
        
        key2 = """
        The quick brown \
        
        
          fox jumps over \
            the lazy dog."""
        
        key3 = """\
               The quick brown \
               fox jumps over \
               the lazy dog.\
               """
        
        [string.literal]
        
        # What you see is what you get.
        winpath  = 'C:\Users\nodejs\templates'
        winpath2 = '\\ServerX\admin$\system32\'
        quoted   = 'Tom "Dubs" Preston-Werner'
        regex    = '<\i\c*\s*>'
        
        
        [string.literal.multiline]
        
        regex2 = '''I [dw]on't need \d{2} apples'''
        lines  = '''
        The first newline is
        trimmed in raw strings.
           All other whitespace
           is preserved.
        '''
        
        
        ################################################################################
        ## Integer
        
        # Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
        # Negative numbers are prefixed with a minus sign.
        
        [integer]
        
        key1 = +99
        key2 = 42
        key3 = 0
        key4 = -17
        
        [integer.underscores]
        
        # For large numbers, you may use underscores to enhance readability. Each
        # underscore must be surrounded by at least one digit.
        key1 = 1_000
        key2 = 5_349_221
        key3 = 1_2_3_4_5     # valid but inadvisable
        
        
        ################################################################################
        ## Float
        
        # A float consists of an integer part (which may be prefixed with a plus or
        # minus sign) followed by a fractional part and/or an exponent part.
        
        [float.fractional]
        
        key1 = +1.0
        key2 = 3.1415
        key3 = -0.01
        
        [float.exponent]
        
        key1 = 5e+22
        key2 = 1e6
        key3 = -2E-2
        
        [float.both]
        
        key = 6.626e-34
        
        [float.underscores]
        
        key1 = 9_224_617.445_991_228_313
        key2 = 1e1_00
        
        
        ################################################################################
        ## Boolean
        
        # Booleans are just the tokens you're used to. Always lowercase.
        
        [boolean]
        
        True = true
        False = false
        
        
        ################################################################################
        ## Datetime
        
        # Datetimes are RFC 3339 dates.
        
        [datetime]
        
        key1 = 1979-05-27T07:32:00Z
        key2 = 1979-05-27T00:32:00-07:00
        key3 = 1979-05-27T00:32:00.999999-07:00
        
        
        ################################################################################
        ## Array
        
        # Arrays are square brackets with other primitives inside. Whitespace is
        # ignored. Elements are separated by commas. Data types may not be mixed.
        
        [array]
        
        key1 = [ 1, 2, 3 ]
        key2 = [ "red", "yellow", "green" ]
        key3 = [ [ 1, 2 ], [3, 4, 5] ]
        key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
        
        # Arrays can also be multiline. So in addition to ignoring whitespace, arrays
        # also ignore newlines between the brackets.  Terminating commas are ok before
        # the closing bracket.
        
        key5 = [
          1, 2, 3
        ]
        key6 = [
          1,
          2, # this is ok
        ]
        
        
        ################################################################################
        ## Array of Tables
        
        # These can be expressed by using a table name in double brackets. Each table
        # with the same double bracketed name will be an element in the array. The
        # tables are inserted in the order encountered.
        
        [[products]]
        
        name = "Hammer"
        sku = 738594937
        
        [[products]]
        
        [[products]]
        
        name = "Nail"
        sku = 284758393
        color = "gray"
        
        
        # You can create nested arrays of tables as well.
        
        [[fruit]]
          name = "apple"
        
          [fruit.physical]
            color = "red"
            shape = "round"
        
          [[fruit.variety]]
            name = "red delicious"
        
          [[fruit.variety]]
            name = "granny smith"
        
        [[fruit]]
          name = "banana"
        
          [[fruit.variety]]
            name = "plantain"
        
        diff:
         {
          Table: {
           Key: "value",
           Subtable: {
            Key: "another value",
           },
           Inline: {
            Name: {
             First: "Tom",
             Last: "Preston-Werner",
            },
            Point: {
             x: 1,
             y: 2,
            },
           },
          },
          X: {
           Y: {
            Z: {
             W: {
             },
            },
           },
          },
          String: {
           Basic: {
            Basic: "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF.",
           },
           Multiline: {
            Key1: "One\nTwo",
            Key2: "One\nTwo",
        -   Key3: "One\r\nTwo",
        +   Key3: "One\nTwo",
            Continued: {
             Key1: "The quick brown fox jumps over the lazy dog.",
             Key2: "The quick brown fox jumps over the lazy dog.",
             Key3: "The quick brown fox jumps over the lazy dog.",
            },
           },
           Literal: {
            Winpath: "C:\\Users\\nodejs\\templates",
            Winpath2: "\\\\ServerX\\admin$\\system32\\",
            Quoted: "Tom \"Dubs\" Preston-Werner",
            Regex: "<\\i\\c*\\s*>",
            Multiline: {
             Regex2: "I [dw]on't need \\d{2} apples",
        -    Lines: "The first newline is\r\ntrimmed in raw strings.\r\n   All other whitespace\r\n   is preserved.\r\n",
        +    Lines: "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n",
            },
           },
          },
          Integer: {
           Key1: 99,
           Key2: 42,
           Key3: 0,
           Key4: -17,
           Underscores: {
            Key1: 1000,
            Key2: 5349221,
            Key3: 12345,
           },
          },
          Float: {
           Fractional: {
            Key1: 1,
            Key2: 3.1415,
            Key3: -0.01,
           },
           Exponent: {
            Key1: 5e+22,
            Key2: 1e+06,
            Key3: -0.02,
           },
           Both: {
            Key: 6.626e-34,
           },
           Underscores: {
            Key1: 9.224617445991227e+06,
            Key2: 1e+100,
           },
          },
          Boolean: {
           True: true,
           False: false,
          },
          Datetime: {
           Key1: 1979-05-27 07:32:00 +0000 UTC,
           Key2: 1979-05-27 00:32:00 -0700 -0700,
           Key3: 1979-05-27 00:32:00.999999 -0700 -0700,
          },
          Array: {
           Key1: [1,2,3],
           Key2: ["red","yellow","green"],
           Key3: [[1,2],[3,4,5]],
           Key4: [[1,2],["a","b","c"]],
           Key5: [1,2,3],
           Key6: [1,2],
          },
          Products: [
           {
            Name: "Hammer",
            Sku: 738594937,
            Color: "",
           },
           {
            Name: "",
            Sku: 0,
            Color: "",
           },
           {
            Name: "Nail",
            Sku: 284758393,
            Color: "gray",
           },
          ],
          Fruit: [
           {
            Name: "apple",
            Physical: {
             Color: "red",
             Shape: "round",
            },
            Variety: [{Name:"red delicious"},{Name:"granny smith"}],
           },
           {
            Name: "banana",
            Physical: {
             Color: "",
             Shape: "",
            },
            Variety: [{Name:"plantain"}],
           },
          ],
         }
=== RUN   TestUnmarshal_WithString
--- FAIL: TestUnmarshal_WithString (0.00s)
    decode_test.go:321: Unmarshal value mismatch for input:
        # unmarshal-string-1.toml
        
        key1 = "One\nTwo"
        key2 = """One\nTwo"""
        key3 = """
        One
        Two"""
        
        diff:
         {
          Str: "",
          Key1: "One\nTwo",
          Key2: "One\nTwo",
        - Key3: "One\r\nTwo",
        + Key3: "One\nTwo",
          Winpath: "",
          Winpath2: "",
          Quoted: "",
          Regex: "",
          Regex2: "",
          Lines: "",
         }
    decode_test.go:321: Unmarshal value mismatch for input:
        # unmarshal-string-2.toml
        
        regex2 = '''I [dw]on't need \d{2} apples'''
        lines  = '''
        The first newline is
        trimmed in raw strings.
           All other whitespace
           is preserved.
        '''
        diff:
         {
          Str: "",
          Key1: "",
          Key2: "",
          Key3: "",
          Winpath: "",
          Winpath2: "",
          Quoted: "",
          Regex: "",
          Regex2: "I [dw]on't need \\d{2} apples",
        - Lines: "The first newline is\r\ntrimmed in raw strings.\r\n   All other whitespace\r\n   is preserved.\r\n",
        + Lines: "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n",
         }
=== RUN   TestUnmarshal_WithInteger
--- PASS: TestUnmarshal_WithInteger (0.00s)
=== RUN   TestUnmarshal_WithFloat
--- PASS: TestUnmarshal_WithFloat (0.00s)
=== RUN   TestUnmarshal_WithBoolean
--- PASS: TestUnmarshal_WithBoolean (0.00s)
=== RUN   TestUnmarshal_WithDatetime
--- PASS: TestUnmarshal_WithDatetime (0.00s)
=== RUN   TestUnmarshal_WithArray
--- PASS: TestUnmarshal_WithArray (0.00s)
=== RUN   TestUnmarshal_WithTable
--- FAIL: TestUnmarshal_WithTable (0.00s)
    decode_test.go:318: Error mismatch for input:
        # unmarshal-table-conflict-1.toml
        # Table a is defined twice.
        
        [a]
        b = 1
        
        [a]
        c = 2
        
        got:  line 13: table `a' is in conflict with table in line 7
        want: line 7: table `a' is in conflict with table in line 4
    decode_test.go:318: Error mismatch for input:
        # unmarshal-table-conflict-2.toml
        # Key b conflicts with table a.b.
        
        [a]
        b = 1
        
        [a.b]
        c = 2
        
        got:  line 13: table `a.b' is in conflict with line 9
        want: line 7: table `a.b' is in conflict with line 5
    decode_test.go:318: Error mismatch for input:
        # unmarshal-table-conflict-3.toml
        # Key b conflicts with table a.b
        
        [a.b]
        c = 2
        
        [a]
        b = 1
        
        got:  line 15: key `b' is in conflict with table in line 7
        want: line 8: key `b' is in conflict with table in line 4
=== RUN   TestUnmarshal_WithEmbeddedStruct
--- PASS: TestUnmarshal_WithEmbeddedStruct (0.00s)
=== RUN   TestUnmarshal_WithArrayTable
--- FAIL: TestUnmarshal_WithArrayTable (0.00s)
    decode_test.go:318: Error mismatch for input:
        # unmarshal-arraytable-conflict-1.toml
        
        [[fruit]]
        name = "apple"
        
        [[fruit.variety]]
        name = "red delicious"
        
        # This table conflicts with the previous table.
        [fruit.variety]
        name = "granny smith"
        
        got:  line 19: table `fruit.variety' is in conflict with array table in line 11
        want: line 10: table `fruit.variety' is in conflict with array table in line 6
    decode_test.go:318: Error mismatch for input:
        # unmarshal-arraytable-conflict-2.toml
        
        [[fruit]]
        name = "apple"
        
        [fruit.variety]
        name = "granny smith"
        
        # This table conflicts with the previous table.
        [[fruit.variety]]
        name = "red delicious"
        
        got:  line 19: array table `fruit.variety' is in conflict with table in line 11
        want: line 10: array table `fruit.variety' is in conflict with table in line 6
    decode_test.go:318: Error mismatch for input:
        # unmarshal-arraytable-conflict-3.toml
        
        [[fruit]]
        name = "apple"
        variety = { name = "granny smith" }
        
        # conflicts with inline table above
        [[fruit.variety]]
        
        got:  line 15: array table `fruit.variety' is in conflict with table in line 9
        want: line 8: array table `fruit.variety' is in conflict with table in line 5
=== RUN   TestUnmarshal_WithUnmarshaler
--- FAIL: TestUnmarshal_WithUnmarshaler (0.00s)
    decode_test.go:998: toml.Unmarshal(data, &v); v => toml.testStruct{Title:"Unmarshaled: \"testtitle\"", MaxConn:"Unmarshaled: 777", Ports:"Unmarshaled: [8080, 8081, 8082]", Servers:"Unmarshaled: [1, 2, 3]", Table:"Unmarshaled: [table]\r\nname = \"alice\"", Arraytable:"Unmarshaled: [[arraytable]]\r\nname = \"alice\"\n[[arraytable]]\r\nname = \"bob\"", ArrayOfStruct:[]toml.testUnmarshalerStruct{toml.testUnmarshalerStruct{Title:"Unmarshaled: [[array_of_struct]]\r\ntitle = \"Alice's Adventures in Wonderland\"\r\nauthor = \"Lewis Carroll\"", Author:""}}}; want toml.testStruct{Title:"Unmarshaled: \"testtitle\"", MaxConn:"Unmarshaled: 777", Ports:"Unmarshaled: [8080, 8081, 8082]", Servers:"Unmarshaled: [1, 2, 3]", Table:"Unmarshaled: [table]\nname = \"alice\"", Arraytable:"Unmarshaled: [[arraytable]]\nname = \"alice\"\n[[arraytable]]\nname = \"bob\"", ArrayOfStruct:[]toml.testUnmarshalerStruct{toml.testUnmarshalerStruct{Title:"Unmarshaled: [[array_of_struct]]\ntitle = \"Alice's Adventures in Wonderland\"\nauthor = \"Lewis Carroll\"", Author:""}}}
=== RUN   TestUnmarshal_WithUnmarshalerForTopLevelStruct
--- PASS: TestUnmarshal_WithUnmarshalerForTopLevelStruct (0.00s)
=== RUN   TestUnmarshal_WithTextUnmarshaler
--- PASS: TestUnmarshal_WithTextUnmarshaler (0.00s)
=== RUN   TestUnmarshal_WithUnmarshalerRec
--- PASS: TestUnmarshal_WithUnmarshalerRec (0.00s)
=== RUN   TestUnmarshal_WithMultibyteString
--- PASS: TestUnmarshal_WithMultibyteString (0.00s)
=== RUN   TestUnmarshal_WithPointers
--- PASS: TestUnmarshal_WithPointers (0.00s)
=== RUN   TestUnmarshalMap
--- PASS: TestUnmarshalMap (0.00s)
=== RUN   TestUnmarshal_WithQuotedKeyValue
--- PASS: TestUnmarshal_WithQuotedKeyValue (0.00s)
=== RUN   TestUnmarshal_WithCustomPrimitiveType
--- PASS: TestUnmarshal_WithCustomPrimitiveType (0.00s)
=== RUN   TestUnmarshal_WithInterface
--- PASS: TestUnmarshal_WithInterface (0.00s)
=== RUN   TestMarshal
--- FAIL: TestMarshal (0.00s)
    encode_test.go:185: Output mismatch:
        Value:
        {Table:    {Key:      "value",
                    Subtable: {Key: "another value"},
                    Inline:   {Name:  {First: "Tom",
                                       Last:  "Preston-Werner"},
                               Point: {x: 1,
                                       y: 2}}},
         X:        {Y: {Z: {W: {}}}},
         String:   {Basic:     {Basic: "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."},
                    Multiline: {Key1:      "One\nTwo",
                                Key2:      "One\nTwo",
                                Key3:      "One\nTwo",
                                Continued: {Key1: "The quick brown fox jumps over the lazy dog.",
                                            Key2: "The quick brown fox jumps over the lazy dog.",
                                            Key3: "The quick brown fox jumps over the lazy dog."}},
                    Literal:   {Winpath:   "C:\\Users\\nodejs\\templates",
                                Winpath2:  "\\\\ServerX\\admin$\\system32\\",
                                Quoted:    "Tom \"Dubs\" Preston-Werner",
                                Regex:     "<\\i\\c*\\s*>",
                                Multiline: {Regex2: "I [dw]on't need \\d{2} apples",
                                            Lines:  "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n"}}},
         Integer:  {Key1:        99,
                    Key2:        42,
                    Key3:        0,
                    Key4:        -17,
                    Underscores: {Key1: 1000,
                                  Key2: 5349221,
                                  Key3: 12345}},
         Float:    {Fractional:  {Key1: 1,
                                  Key2: 3.1415,
                                  Key3: -0.01},
                    Exponent:    {Key1: 5e+22,
                                  Key2: 1e+06,
                                  Key3: -0.02},
                    Both:        {Key: 6.626e-34},
                    Underscores: {Key1: 9.224617445991227e+06,
                                  Key2: 1e+100}},
         Boolean:  {True:  true,
                    False: false},
         Datetime: {Key1: 1979-05-27 07:32:00 +0000 UTC,
                    Key2: 1979-05-27 00:32:00 -0700 -0700,
                    Key3: 1979-05-27 00:32:00.999999 -0700 -0700},
         Array:    {Key1: [1,2,3],
                    Key2: ["red","yellow","green"],
                    Key3: [[1,2],[3,4,5]],
                    Key4: [[1,2],["a","b","c"]],
                    Key5: [1,2,3],
                    Key6: [1,2]},
         Products: [{Name:  "Hammer",
                     Sku:   738594937,
                     Color: ""},
                    {Name:  "",
                     Sku:   0,
                     Color: ""},
                    {Name:  "Nail",
                     Sku:   284758393,
                     Color: "gray"}],
         Fruit:    [{Name:     "apple",
                     Physical: {Color: "red",
                                Shape: "round"},
                     Variety:  [{Name:"red delicious"},{Name:"granny smith"}]},
                    {Name:     "banana",
                     Physical: {Color: "",
                                Shape: ""},
                     Variety:  [{Name:"plantain"}]}]}
        Diff:
        -[table]
        -key = "value"
        +[table]
        +key = "value"
        +
        +[table.subtable]
        +key = "another value"
        +
        +[table.inline.name]
        +first = "Tom"
        +last = "Preston-Werner"
        +
        +[table.inline.point]
        +x = 1
        +y = 2
        +
        +[string.basic]
        +basic = "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
        +
        +[string.multiline]
        +key1 = "One\nTwo"
        +key2 = "One\nTwo"
        +key3 = "One\nTwo"
        +
        +[string.multiline.continued]
        +key1 = "The quick brown fox jumps over the lazy dog."
        +key2 = "The quick brown fox jumps over the lazy dog."
        +key3 = "The quick brown fox jumps over the lazy dog."
        +
        +[string.literal]
        +winpath = "C:\\Users\\nodejs\\templates"
        +winpath2 = "\\\\ServerX\\admin$\\system32\\"
        +quoted = "Tom \"Dubs\" Preston-Werner"
        +regex = "<\\i\\c*\\s*>"
        +
        +[string.literal.multiline]
        +regex2 = "I [dw]on't need \\d{2} apples"
        +lines = "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n"
        +
        +[integer]
        +key1 = 99
        +key2 = 42
        +key3 = 0
        +key4 = -17
        +
        +[integer.underscores]
        +key1 = 1000
        +key2 = 5349221
        +key3 = 12345
        +
        +[float.fractional]
        +key1 = 1e+00
        +key2 = 3.1415e+00
        +key3 = -1e-02
        +
        +[float.exponent]
        +key1 = 5e+22
        +key2 = 1e+06
        +key3 = -2e-02
        +
        +[float.both]
        +key = 6.626e-34
        +
        +[float.underscores]
        +key1 = 9.224617445991227e+06
        +key2 = 1e+100
        +
        +[boolean]
        +true = true
        +false = false
        +
        +[datetime]
        +key1 = 1979-05-27T07:32:00Z
        +key2 = 1979-05-27T00:32:00-07:00
        +key3 = 1979-05-27T00:32:00.999999-07:00
        +
        +[array]
        +key1 = [1, 2, 3]
        +key2 = ["red", "yellow", "green"]
        +key3 = [[1, 2], [3, 4, 5]]
        +key4 = [[1, 2], ["a", "b", "c"]]
        +key5 = [1, 2, 3]
        +key6 = [1, 2]
        +
        +[[products]]
        +name = "Hammer"
        +sku = 738594937
        +
        +[[products]]
        +
        +[[products]]
        +name = "Nail"
        +sku = 284758393
        +color = "gray"
        +
        +[[fruit]]
        +name = "apple"
        +
        +[fruit.physical]
        +color = "red"
        +shape = "round"
        +
        +[[fruit.variety]]
        +name = "red delicious"
        +
        +[[fruit.variety]]
        +name = "granny smith"
        +
        +[[fruit]]
        +name = "banana"
        +
        +[fruit.physical]
        +color = ""
        +shape = ""
        +
        +[[fruit.variety]]
        +name = "plantain"
         
        -[table.subtable]
        -key = "another value"
        -
        -[table.inline.name]
        -first = "Tom"
        -last = "Preston-Werner"
        -
        -[table.inline.point]
        -x = 1
        -y = 2
        -
        -[string.basic]
        -basic = "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."
        -
        -[string.multiline]
        -key1 = "One\nTwo"
        -key2 = "One\nTwo"
        -key3 = "One\nTwo"
        -
        -[string.multiline.continued]
        -key1 = "The quick brown fox jumps over the lazy dog."
        -key2 = "The quick brown fox jumps over the lazy dog."
        -key3 = "The quick brown fox jumps over the lazy dog."
        -
        -[string.literal]
        -winpath = "C:\\Users\\nodejs\\templates"
        -winpath2 = "\\\\ServerX\\admin$\\system32\\"
        -quoted = "Tom \"Dubs\" Preston-Werner"
        -regex = "<\\i\\c*\\s*>"
        -
        -[string.literal.multiline]
        -regex2 = "I [dw]on't need \\d{2} apples"
        -lines = "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n"
        -
        -[integer]
        -key1 = 99
        -key2 = 42
        -key3 = 0
        -key4 = -17
        -
        -[integer.underscores]
        -key1 = 1000
        -key2 = 5349221
        -key3 = 12345
        -
        -[float.fractional]
        -key1 = 1e+00
        -key2 = 3.1415e+00
        -key3 = -1e-02
        -
        -[float.exponent]
        -key1 = 5e+22
        -key2 = 1e+06
        -key3 = -2e-02
        -
        -[float.both]
        -key = 6.626e-34
        -
        -[float.underscores]
        -key1 = 9.224617445991227e+06
        -key2 = 1e+100
        -
        -[boolean]
        -true = true
        -false = false
        -
        -[datetime]
        -key1 = 1979-05-27T07:32:00Z
        -key2 = 1979-05-27T00:32:00-07:00
        -key3 = 1979-05-27T00:32:00.999999-07:00
        -
        -[array]
        -key1 = [1, 2, 3]
        -key2 = ["red", "yellow", "green"]
        -key3 = [[1, 2], [3, 4, 5]]
        -key4 = [[1, 2], ["a", "b", "c"]]
        -key5 = [1, 2, 3]
        -key6 = [1, 2]
        -
        -[[products]]
        -name = "Hammer"
        -sku = 738594937
        -
        -[[products]]
        -
        -[[products]]
        -name = "Nail"
        -sku = 284758393
        -color = "gray"
        -
        -[[fruit]]
        -name = "apple"
        -
        -[fruit.physical]
        -color = "red"
        -shape = "round"
        -
        -[[fruit.variety]]
        -name = "red delicious"
        -
        -[[fruit.variety]]
        -name = "granny smith"
        -
        -[[fruit]]
        -name = "banana"
        -
        -[fruit.physical]
        -color = ""
        -shape = ""
        -
        -[[fruit.variety]]
        -name = "plantain"
        -
    encode_test.go:185: Output mismatch:
        Value:
        {intKeys:       {1: 1,
                         2: 2,
                         3: 3},
         marshalerKeys: {0001-01-01 00:00:00 +0000 UTC: 1}}
        Diff:
        -[intKeys]
        -1 = 1
        -2 = 2
        -3 = 3
        +[intKeys]
        +1 = 1
        +2 = 2
        +3 = 3
        +
        +[marshalerKeys]
        +"0001-01-01T00:00:00Z" = 1
         
        -[marshalerKeys]
        -"0001-01-01T00:00:00Z" = 1
        -
    encode_test.go:185: Output mismatch:
        Value:
        {m1: {S: "1"},
         m2: {S: "2"},
         m3: {S: "3"}}
        Diff:
        -m1 = 1
        -m2 = 2
        -m3 = 3
        +m1 = 1
        +m2 = 2
        +m3 = 3
         
    encode_test.go:185: Output mismatch:
        Value:
        {m1:  {},
         m2:  {},
         m3:  {},
         sub: {}}
        Diff:
        -m1 = 1
        -m2 = 2
        -m3 = 3
        +m1 = 1
        +m2 = 2
        +m3 = 3
        +
        +[sub]
        +key = 1
         
        -[sub]
        -key = 1
        -
    encode_test.go:185: Output mismatch:
        Value:
        {:                    "empty",
          :                   "space",
         -:                   "dash (not quoted)",
         1:                   "number (not quoted)",
         subtable with space: {depth:                  1,
                               subsubtable with space: {depth: 2}},
         ʎǝʞ:              "reverse"}
        Diff:
        -"" = "empty"
        -" " = "space"
        -- = "dash (not quoted)"
        -1 = "number (not quoted)"
        -"ʎǝʞ" = "reverse"
        +"" = "empty"
        +" " = "space"
        +- = "dash (not quoted)"
        +1 = "number (not quoted)"
        +"ʎǝʞ" = "reverse"
        +
        +["subtable with space"]
        +depth = 1
        +
        +["subtable with space"."subsubtable with space"]
        +depth = 2
         
        -["subtable with space"]
        -depth = 1
        -
        -["subtable with space"."subsubtable with space"]
        -depth = 2
        -
=== RUN   TestMarshalRoundTrip
--- PASS: TestMarshalRoundTrip (0.00s)
=== RUN   TestMarshalArrayTableEmptyParent
--- FAIL: TestMarshalArrayTableEmptyParent (0.00s)
    encode_test.go:222: Output mismatch:
        -[[bars]]
        -[bars.baz]
        -key = 1
        +[[bars]]
        +[bars.baz]
        +key = 1
        +
        +[[bars]]
        +[bars.baz]
        +key = 2
         
        -[[bars]]
        -[bars.baz]
        -key = 2
        -
=== RUN   TestMarshalPointerError
--- PASS: TestMarshalPointerError (0.00s)
=== RUN   TestMarshalNonStruct
--- PASS: TestMarshalNonStruct (0.00s)
=== RUN   TestMarshalOmitempty
--- PASS: TestMarshalOmitempty (0.00s)
=== RUN   Example
--- PASS: Example (0.00s)
=== RUN   ExampleUnmarshalerRec
--- PASS: ExampleUnmarshalerRec (0.00s)
=== RUN   ExampleUnmarshaler
--- PASS: ExampleUnmarshaler (0.00s)
=== RUN   Example_textUnmarshaler
--- PASS: Example_textUnmarshaler (0.00s)
=== RUN   Example_textUnmarshalerError
--- PASS: Example_textUnmarshalerError (0.00s)
FAIL
FAIL	github.com/naoina/toml	0.283s
?   	github.com/naoina/toml/ast	[no test files]
vlastahajek pushed a commit to bonitoo-io/toml that referenced this issue Aug 1, 2019
vlastahajek pushed a commit to bonitoo-io/toml that referenced this issue Aug 1, 2019
vlastahajek pushed a commit to bonitoo-io/toml that referenced this issue Aug 15, 2019
vlastahajek pushed a commit to bonitoo-io/toml that referenced this issue Aug 15, 2019
vlastahajek added a commit to bonitoo-io/toml that referenced this issue Aug 15, 2019
vlastahajek added a commit to bonitoo-io/toml that referenced this issue Aug 15, 2019
@fjl
Copy link
Collaborator

fjl commented Jul 12, 2021

I fixed it a bit differently in baf5034.

@fjl fjl closed this as completed Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants