Two possible Date related regressions
eddelbuettel opened this issue · comments
Lovely to see toml 0.5 support. I just carried this over to my RcppTOML but I ran into two regressions, both Date related.
First, Tom's own example.toml
no longer parses. The line
dob = 1979-05-27T07:32:00-08:00 # First class dates
fails, but passes once the comment is removed:
dob = 1979-05-27T07:32:00-08:00
Similarly, I have a file example4.toml
and it now falls over
bla = [ 1979-05-27T07:32:00Z, 1979-05-28T07:32:00Z ]
but the dates pass individually. The spec is silent about whether arrays of dates are allowed or not, but they worked in the past and I don't see why they should be excluded.
Using just your code, and a binary I still had from a previous work, shows it used to work:
edd@rob:~/git/cpptoml/examples(master)$ g++ -o parse_stdin_2018-10-15 parse_stdin.cpp -I ../include/
edd@rob:~/git/cpptoml/examples(master)$ echo "bla = [ 1979-05-27T07:32:00Z, 1979-05-28T07:32:00Z ] " | ./parse_stdin_2018-10-15
Parsing failed: Malformed date at line 1
edd@rob:~/git/cpptoml/examples(master)$ echo "dob = 1979-05-27T07:32:00-08:00 # First class dates" | ./parse_stdin_2018-10-15
Parsing failed: Malformed date at line 1
edd@rob:~/git/cpptoml/examples(master)$
edd@rob:~/git/cpptoml/examples(master)$ ls -l parse_stdin*
-rwxrwxr-x 1 edd edd 571400 Jan 22 2017 parse_stdin_2017-01-22
-rwxr-xr-x 1 edd edd 583560 Oct 15 06:43 parse_stdin_2018-10-15
-rw-rw-r-- 1 edd edd 3284 Feb 8 2017 parse_stdin.cpp
edd@rob:~/git/cpptoml/examples(master)$ echo "dob = 1979-05-27T07:32:00-08:00 # First class dates" | ./parse_stdin_2017-01-22
{"dob":{"type":"datetime","value":"1979-05-27T07:32:00-08:00"}}
edd@rob:~/git/cpptoml/examples(master)$ echo "bla = [ 1979-05-27T07:32:00Z, 1979-05-28T07:32:00Z ] " | ./parse_stdin_2017-01-22
{"bla":{"type":"array","value":[{"type":"datetime","value":"1979-05-27T07:32:00Z"}, {"type":"datetime","value":"1979-05-28T07:32:00Z"}]}}
edd@rob:~/git/cpptoml/examples(master)$
I had another look at the toml-test
set. These still look like deficiencies / regressions to me.
But example.toml
passed if we remove the comment.
And the array example passes if we write it as
bla = [
1979-05-27T07:32:00Z,
1979-05-28T07:32:00Z,
]
It would still be preferable if this passed as it did before:
dob = 1979-05-27T07:32:00-08:00 # First class dates
bla = [ 1979-05-27T07:32:00Z, 1979-05-28T07:32:00Z ]
but it does not right now.
Found similar issue when parsing the example TOML:
libc++abi.dylib: terminating with uncaught exception of type cpptoml::parse_exception: Malformed date at line 7
And line 7 is this:
dob = 1979-05-27T07:32:00-08:00 # First class dates
Yes, see my initial comment above. The main example.toml
contains it, and that currently fails.
Should be fixed now I think. Sorry for the regression.
Woot! Will test later today / this week.