emancu/toml-rb

Continued multiline strings in arrays aren't parsed correctly

Closed this issue · 3 comments

multiline.toml:

s1 = """This \

        is \
        a \
        test \
            string"""

s2 = "This is a test string"

array = ["""This \

            is \
            a \
            test \
                string""", "This is a test string"]

multiline.rb:

#!/usr/bin/env ruby
require 'toml'

toml = TOML.load_file(ARGV[0])

p toml['s1']
p toml['s2']

p toml['s1'] == toml['s2']

p toml['array'][0]
p toml['array'][1]

p toml['array'][0] == toml['array'][1]

Result of running ./multiline.rb multiline.toml:

"This is a test string"
"This is a test string"
true
"This   \n            is             a             test                 string"
"This is a test string"
false

Thanks for reporting this @tsudoko !
During this week I will take a look and give you more feedback.

@tsudoko this is more complicated than expected, somehow the parser uses the regular string parser instead o multiline one. I will keep you poested

@tsudoko fixed !

Update your gem to version 0.3.15