Skip to content

Commit

Permalink
Remove nanosecond datetime tests, document implementation-defined beh…
Browse files Browse the repository at this point in the history
…aviour

I considered copying this to a special "optional" directory or
something, but it gets very complicated very fast with different
permutations. There's no telling what precision an implementation
supports.

So just document it. It makes things easier for everyone.

Fixes #91
  • Loading branch information
arp242 committed Nov 24, 2021
1 parent 5c4b02c commit 850bb72
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ An example implementation can be found in the BurnSushi/toml:
- [Add tags](https://github.com/BurntSushi/toml/blob/master/internal/tag/add.go)
- [Remove tags](https://github.com/BurntSushi/toml/blob/master/internal/tag/rm.go)

Implementation-defined behaviour
--------------------------------
This only tests behaviour that's should be true for every encoder implementing
TOML; a few things are left up to implementations, and are not tested here.

- Millisecond precision (4 digits) is required for datetimes and times, and
further precision is implementation-specific, and any greater precision than
is supported must be truncated (not rounded).

This tests only millisecond precision, and not any further precision or the
truncation of it.


Assumptions of Truth
--------------------
The following are taken as ground truths by `toml-test`:
Expand Down
8 changes: 4 additions & 4 deletions tests/valid/datetime/milliseconds.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"utc1": {
"type": "datetime",
"value": "1987-07-05T17:45:56.123456Z"
"value": "1987-07-05T17:45:56.1234Z"
},
"utc2": {
"type": "datetime",
"value": "1987-07-05T17:45:56.600000Z"
"value": "1987-07-05T17:45:56.6000Z"
},
"wita1": {
"type": "datetime",
"value": "1987-07-05T17:45:56.123456+08:00"
"value": "1987-07-05T17:45:56.1234+08:00"
},
"wita2": {
"type": "datetime",
"value": "1987-07-05T17:45:56.600000+08:00"
"value": "1987-07-05T17:45:56.6000+08:00"
}
}
4 changes: 2 additions & 2 deletions tests/valid/datetime/milliseconds.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
utc1 = 1987-07-05T17:45:56.123456Z
utc1 = 1987-07-05T17:45:56.1234Z
utc2 = 1987-07-05T17:45:56.6Z
wita1 = 1987-07-05T17:45:56.123456+08:00
wita1 = 1987-07-05T17:45:56.1234+08:00
wita2 = 1987-07-05T17:45:56.6+08:00

0 comments on commit 850bb72

Please sign in to comment.