File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed
Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ rm -rf vlib/toml/tests/testdata/iarna vlib/toml/tests/testdata/toml_rs vlib/toml
1010git -C vlib/toml/tests/testdata/iarna checkout 1880b1a
1111
1212./v retry -- git clone -n https://github.com/toml-lang/toml-test.git vlib/toml/tests/testdata/toml_lang
13- git -C vlib/toml/tests/testdata/toml_lang checkout c6a78f1
13+ git -C vlib/toml/tests/testdata/toml_lang checkout 8bb8d9c
1414
1515# A few history notes of toml-rs (previously alexcrichton):
1616# commit 7f5472c the test-suite dir moves to the crates/ sub-directory
Original file line number Diff line number Diff line change @@ -405,6 +405,32 @@ fn (c &Checker) check_time(t ast.Time) ! {
405405 ' "${lit} " is not a valid RFC 3339 Time format string in ...${c.excerpt(t.pos)} ...' )
406406 }
407407
408+ if parts.len > 1 {
409+ // Offset
410+ offset_parts := parts[1 ].split (':' )
411+ if offset_parts.len != 2 {
412+ return error (@MOD + '.' + @STRUCT + '.' + @FN +
413+ ' "${parts[1]} " is not a valid RFC 3339 time offset specifier in ...${c.excerpt(t.pos)} ...' )
414+ }
415+ hh := offset_parts[0 ].int ()
416+ if hh < 0 || hh > 24 {
417+ pos := token.Pos{
418+ ...t.pos
419+ pos: t.pos.pos + check_length
420+ }
421+ return error (@MOD + '.' + @STRUCT + '.' + @FN +
422+ ' "${hh} " hour specifier in "${parts[1]} " should be between 00 and 24 in ...${c.excerpt(pos)} ...' )
423+ }
424+ mm := offset_parts[1 ].int ()
425+ if mm < 0 || mm > 59 {
426+ pos := token.Pos{
427+ ...t.pos
428+ pos: t.pos.pos + check_length
429+ }
430+ return error (@MOD + '.' + @STRUCT + '.' + @FN +
431+ ' "${mm} " second specifier in "${parts[1]} " should be between 00 and 59 in ...${c.excerpt(pos)} ...' )
432+ }
433+ }
408434 // Simulate a time offset if it's missing then it can be checked. Already toml supports local time and rfc3339 don't.
409435 mut has_time_offset := false
410436 for ch in parts[0 ]#[8 ..] {
Original file line number Diff line number Diff line change 11// Instructions for developers:
22// The actual tests and data can be obtained by doing:
33// `git clone -n https://github.com/toml-lang/toml-test.git vlib/toml/tests/testdata/toml_lang`
4- // `git -C vlib/toml/tests/testdata/toml_lang reset --hard c6a78f1
4+ // `git -C vlib/toml/tests/testdata/toml_lang reset --hard 8bb8d9c
55// See also the CI toml tests
66import os
77import toml
You can’t perform that action at this time.
0 commit comments