From a52fa78484fbe45506de448720a17fc50710dba4 Mon Sep 17 00:00:00 2001 From: Greg Hendershott Date: Sun, 29 Jun 2014 18:43:42 -0400 Subject: [PATCH 01/19] Add Racket implementation to README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d8fcaa1..053c5e1 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,7 @@ note the commit SHA1 or version tag that your parser supports in your `README`. * Go w/ Reflection (@BurntSushi) - https://github.com/BurntSushi/toml/tree/master/cmd/toml-test-decoder * Python (@uiri) - https://github.com/uiri/toml * Python (@marksteve) - https://github.com/marksteve/toml-ply +* Racket (@greghendershott) - https://github.com/greghendershott/toml * Ruby (@jm, @cespare) - https://gist.github.com/cespare/5052442 * Rust (@mneumann) - https://github.com/mneumann/rust-toml From 3bf740a85076170907995f9b8f138048280d73f3 Mon Sep 17 00:00:00 2001 From: redhotvengeance Date: Mon, 30 Jun 2014 00:22:42 -0700 Subject: [PATCH 02/19] Add topl lib to list of decoders --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d8fcaa1..982babd 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ note the commit SHA1 or version tag that your parser supports in your `README`. * C++ (@skystrife) - https://github.com/skystrife/cpptoml * Go (@thompelletier) - https://github.com/pelletier/go-toml * Go w/ Reflection (@BurntSushi) - https://github.com/BurntSushi/toml/tree/master/cmd/toml-test-decoder +* Node.js/Browser (@redhotvengeance) - https://github.com/redhotvengeance/topl * Python (@uiri) - https://github.com/uiri/toml * Python (@marksteve) - https://github.com/marksteve/toml-ply * Ruby (@jm, @cespare) - https://gist.github.com/cespare/5052442 From 8f23d1b88170f209daf8cfe8bc59520b0e24a490 Mon Sep 17 00:00:00 2001 From: Leonel Quinteros Date: Fri, 27 Mar 2015 15:38:52 -0300 Subject: [PATCH 03/19] New decoder supporting this test suite https://github.com/leonelquinteros/php-toml now supports the test suite decoder interface. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1ba660d..47fe8ae 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ note the commit SHA1 or version tag that your parser supports in your `README`. * C++ (@skystrife) - https://github.com/skystrife/cpptoml * Go (@thompelletier) - https://github.com/pelletier/go-toml * Go w/ Reflection (@BurntSushi) - https://github.com/BurntSushi/toml/tree/master/cmd/toml-test-decoder +* PHP (@leonelquinteros) - https://github.com/leonelquinteros/php-toml * Python (@uiri) - https://github.com/uiri/toml * Python (@marksteve) - https://github.com/marksteve/toml-ply * Ruby (@jm, @cespare) - https://gist.github.com/cespare/5052442 From 6fa014160e193f3179d8aa74b8fc3ed9b175030a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 13 Jun 2017 11:44:12 -0500 Subject: [PATCH 04/19] added lv-toml to TOML project list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1ba660d..7f45101 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ note the commit SHA1 or version tag that your parser supports in your `README`. * C++ (@skystrife) - https://github.com/skystrife/cpptoml * Go (@thompelletier) - https://github.com/pelletier/go-toml * Go w/ Reflection (@BurntSushi) - https://github.com/BurntSushi/toml/tree/master/cmd/toml-test-decoder +* LabVIEW (@dbtaylor) - https://github.com/erdosmiller/lv-toml * Python (@uiri) - https://github.com/uiri/toml * Python (@marksteve) - https://github.com/marksteve/toml-ply * Ruby (@jm, @cespare) - https://gist.github.com/cespare/5052442 From 10571ef42a3eacc0d7686cbcb8f6a96fd5ef3a8f Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Fri, 16 Mar 2018 19:26:58 -0400 Subject: [PATCH 05/19] Comments within multiline array and comma before the closing bracket --- tests/valid/arrays.json | 7 +++++++ tests/valid/arrays.toml | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/tests/valid/arrays.json b/tests/valid/arrays.json index 58aedbc..2445116 100644 --- a/tests/valid/arrays.json +++ b/tests/valid/arrays.json @@ -30,5 +30,12 @@ {"type": "datetime", "value": "1979-05-27T07:32:00Z"}, {"type": "datetime", "value": "2006-06-01T11:00:00Z"} ] + }, + "comments": { + "type": "array", + "value": [ + {"type": "integer", "value": "1"}, + {"type": "integer", "value": "2"} + ] } } diff --git a/tests/valid/arrays.toml b/tests/valid/arrays.toml index c435f57..db1c400 100644 --- a/tests/valid/arrays.toml +++ b/tests/valid/arrays.toml @@ -6,3 +6,7 @@ dates = [ 1979-05-27T07:32:00Z, 2006-06-01T11:00:00Z, ] +comments = [ + 1, + 2, #this is ok +] From 52b42e891816d62d8dd720ee5f1c4aa2d381ce95 Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Sun, 18 Mar 2018 20:07:19 -0400 Subject: [PATCH 06/19] Datetimes are RFC 3339 dates --- README.md | 3 +- json.go | 71 ++++++++++++++++++++++++++++----------- tests/valid/arrays.json | 6 ++-- tests/valid/datetime.json | 4 ++- tests/valid/datetime.toml | 2 ++ tests/valid/example.json | 2 +- 6 files changed, 62 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1ba660d..c131d89 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ and `TVALUE` is always a JSON string, except when `TTYPE` is `array` in which Empty hashes correspond to empty JSON objects (i.e., `{}`) and empty arrays correspond to empty JSON arrays (i.e., `[]`). +Datetime should be encoded following RFC 3339. ### Example JSON encoding @@ -118,7 +119,7 @@ And the JSON encoding expected by `toml-test` is: ```json { - "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, "numtheory": { "boring": {"type": "bool", "value": "false"}, "perfection": { diff --git a/json.go b/json.go index be89629..7cf4a5e 100644 --- a/json.go +++ b/json.go @@ -2,6 +2,7 @@ package main import ( "strconv" + "time" ) // compareJson consumes the recursive structure of both `expected` and `test` @@ -114,29 +115,38 @@ func (r result) cmpJsonValues(e, t map[string]interface{}) result { // equality. if etype == "array" { return r.cmpJsonArrays(e["value"], t["value"]) - } - - // Floats need special attention too. Not every language can - // represent the same floats, and sometimes the string version of - // a float can be wonky with extra zeroes and what not. - if etype == "float" { - enum, ok := e["value"].(string) + } else { + // Atomic values are always strings + evalue, ok := e["value"].(string) if !ok { - return r.failedf("BUG in test case. 'value' should be a string, "+ - "but it is a %T.", e["value"]) + return r.failedf("BUG in test case. 'value' "+ + "should be a string, but it is a %T.", + e["value"]) } - tnum, ok := t["value"].(string) + tvalue, ok := t["value"].(string) if !ok { - return r.failedf("Malformed parser output. 'value' should be a "+ - "string but it is a %T.", t["value"]) + return r.failedf("Malformed parser output. 'value' "+ + "should be a string but it is a %T.", + t["value"]) + } + + // Excepting floats and datetimes, other values can be + // compared as strings. + switch etype { + case "float": + return r.cmpFloats(evalue, tvalue); + case "datetime": + return r.cmpAsDatetimes(evalue, tvalue); + default: + return r.cmpAsStrings(evalue, tvalue); } - return r.cmpFloats(enum, tnum) } +} - // Otherwise, we can do simple string equality. - if e["value"] != t["value"] { +func (r result) cmpAsStrings(e, t string) result { + if e != t { return r.failedf("Values for key '%s' don't match. Expected a "+ - "value of '%s' but got '%s'.", r.key, e["value"], t["value"]) + "value of '%s' but got '%s'.", r.key, e, t) } return r } @@ -144,14 +154,14 @@ func (r result) cmpJsonValues(e, t map[string]interface{}) result { func (r result) cmpFloats(e, t string) result { ef, err := strconv.ParseFloat(e, 64) if err != nil { - return r.failedf("BUG in test case. Could not read '%s' as a float "+ - "value for key '%s'.", e, r.key) + return r.failedf("BUG in test case. Could not read '%s' as a "+ + "float value for key '%s'.", e, r.key) } tf, err := strconv.ParseFloat(t, 64) if err != nil { - return r.failedf("Malformed parser output. Could not read '%s' as "+ - "a float value for key '%s'.", t, r.key) + return r.failedf("Malformed parser output. Could not read '%s' "+ + "as a float value for key '%s'.", t, r.key) } if ef != tf { return r.failedf("Values for key '%s' don't match. Expected a "+ @@ -160,6 +170,27 @@ func (r result) cmpFloats(e, t string) result { return r } +func (r result) cmpAsDatetimes(e, t string) result { + var err error + + ef, err := time.Parse(time.RFC3339Nano, e) + if err != nil { + return r.failedf("BUG in test case. Could not read '%s' as a "+ + "datetime value for key '%s'.", e, r.key) + } + + tf, err := time.Parse(time.RFC3339Nano, t) + if err != nil { + return r.failedf("Malformed parser output. Could not read '%s' "+ + "as datetime value for key '%s'.", t, r.key) + } + if !ef.Equal(tf) { + return r.failedf("Values for key '%s' don't match. Expected a "+ + "value of '%v' but got '%v'.", r.key, ef, tf) + } + return r +} + func isValue(m map[string]interface{}) bool { if len(m) != 2 { return false diff --git a/tests/valid/arrays.json b/tests/valid/arrays.json index 2445116..45b1f56 100644 --- a/tests/valid/arrays.json +++ b/tests/valid/arrays.json @@ -26,9 +26,9 @@ "dates": { "type": "array", "value": [ - {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, - {"type": "datetime", "value": "1979-05-27T07:32:00Z"}, - {"type": "datetime", "value": "2006-06-01T11:00:00Z"} + {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, + {"type": "datetime", "value": "1979-05-27T07:32:00+00:00"}, + {"type": "datetime", "value": "2006-06-01T11:00:00+00:00"} ] }, "comments": { diff --git a/tests/valid/datetime.json b/tests/valid/datetime.json index 2ca93ce..17a7060 100644 --- a/tests/valid/datetime.json +++ b/tests/valid/datetime.json @@ -1,3 +1,5 @@ { - "bestdayever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"} + "bestdayever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, + "numoffset": {"type": "datetime", "value": "1977-06-28T12:32:00+00:00"}, + "milliseconds": {"type": "datetime", "value": "1977-12-21T03:32:00.555+00:00"} } diff --git a/tests/valid/datetime.toml b/tests/valid/datetime.toml index 2e99340..ee787b7 100644 --- a/tests/valid/datetime.toml +++ b/tests/valid/datetime.toml @@ -1 +1,3 @@ bestdayever = 1987-07-05T17:45:00Z +numoffset = 1977-06-28T07:32:00-05:00 +milliseconds = 1977-12-21T10:32:00.555+07:00 diff --git a/tests/valid/example.json b/tests/valid/example.json index 48aa907..33d1a7c 100644 --- a/tests/valid/example.json +++ b/tests/valid/example.json @@ -1,5 +1,5 @@ { - "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, "numtheory": { "boring": {"type": "bool", "value": "false"}, "perfection": { From 2fe8eda7fc2bf322a7fed72890319d4ac345ea70 Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Thu, 15 Mar 2018 21:21:13 -0400 Subject: [PATCH 07/19] Optional + prefix on integers --- tests/valid/integer.json | 3 ++- tests/valid/integer.toml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/valid/integer.json b/tests/valid/integer.json index 61985a1..13e62b8 100644 --- a/tests/valid/integer.json +++ b/tests/valid/integer.json @@ -1,4 +1,5 @@ { "answer": {"type": "integer", "value": "42"}, - "neganswer": {"type": "integer", "value": "-42"} + "neganswer": {"type": "integer", "value": "-42"}, + "posanswer": {"type": "integer", "value": "42"} } diff --git a/tests/valid/integer.toml b/tests/valid/integer.toml index c4f6297..b84130c 100644 --- a/tests/valid/integer.toml +++ b/tests/valid/integer.toml @@ -1,2 +1,3 @@ answer = 42 neganswer = -42 +posanswer = +42 From af01d137831ba4fa6ffed59b31e0654fc088e5b4 Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Thu, 15 Mar 2018 21:23:32 -0400 Subject: [PATCH 08/19] Scientific notation for floats --- tests/valid/exponent-part-float.json | 6 ++++++ tests/valid/exponent-part-float.toml | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 tests/valid/exponent-part-float.json create mode 100644 tests/valid/exponent-part-float.toml diff --git a/tests/valid/exponent-part-float.json b/tests/valid/exponent-part-float.json new file mode 100644 index 0000000..c362c6b --- /dev/null +++ b/tests/valid/exponent-part-float.json @@ -0,0 +1,6 @@ +{ + "million": {"type": "float", "value": "1000000"}, + "minustenth": {"type": "float", "value": "-0.1"}, + "beast": {"type": "float", "value": "666"} +} + diff --git a/tests/valid/exponent-part-float.toml b/tests/valid/exponent-part-float.toml new file mode 100644 index 0000000..41bd282 --- /dev/null +++ b/tests/valid/exponent-part-float.toml @@ -0,0 +1,3 @@ +million = 1e6 +minustenth = -1E-1 +beast = 6.66E2 From 20ca0f9bb6254d51d8d3c5fc851b040f76742dec Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Sun, 18 Mar 2018 20:45:40 -0400 Subject: [PATCH 09/19] Newline is defined as LF or CRLF --- tests/.gitattributes | 1 + tests/valid/newline-crlf.json | 4 ++++ tests/valid/newline-crlf.toml | 2 ++ tests/valid/newline-lf.json | 4 ++++ tests/valid/newline-lf.toml | 2 ++ 5 files changed, 13 insertions(+) create mode 100644 tests/.gitattributes create mode 100644 tests/valid/newline-crlf.json create mode 100644 tests/valid/newline-crlf.toml create mode 100644 tests/valid/newline-lf.json create mode 100644 tests/valid/newline-lf.toml diff --git a/tests/.gitattributes b/tests/.gitattributes new file mode 100644 index 0000000..6381655 --- /dev/null +++ b/tests/.gitattributes @@ -0,0 +1 @@ +*.toml -text diff --git a/tests/valid/newline-crlf.json b/tests/valid/newline-crlf.json new file mode 100644 index 0000000..d32f230 --- /dev/null +++ b/tests/valid/newline-crlf.json @@ -0,0 +1,4 @@ +{ + "os": {"type": "string", "value": "DOS"}, + "newline": {"type": "string", "value": "crlf"} +} diff --git a/tests/valid/newline-crlf.toml b/tests/valid/newline-crlf.toml new file mode 100644 index 0000000..0030024 --- /dev/null +++ b/tests/valid/newline-crlf.toml @@ -0,0 +1,2 @@ +os = "DOS" +newline = "crlf" diff --git a/tests/valid/newline-lf.json b/tests/valid/newline-lf.json new file mode 100644 index 0000000..8114848 --- /dev/null +++ b/tests/valid/newline-lf.json @@ -0,0 +1,4 @@ +{ + "os": {"type": "string", "value": "unix"}, + "newline": {"type": "string", "value": "lf"} +} diff --git a/tests/valid/newline-lf.toml b/tests/valid/newline-lf.toml new file mode 100644 index 0000000..0f3377c --- /dev/null +++ b/tests/valid/newline-lf.toml @@ -0,0 +1,2 @@ +os = "unix" +newline = "lf" From 20ab954277f965e4bcd29e1b3892125ae60a643d Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Sun, 18 Mar 2018 20:46:09 -0400 Subject: [PATCH 10/19] Unicode escapes must be scalar values --- tests/invalid/string-bad-codepoint.toml | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/invalid/string-bad-codepoint.toml diff --git a/tests/invalid/string-bad-codepoint.toml b/tests/invalid/string-bad-codepoint.toml new file mode 100644 index 0000000..aa81356 --- /dev/null +++ b/tests/invalid/string-bad-codepoint.toml @@ -0,0 +1 @@ +invalid-codepoint = "This string contains a non scalar unicode codepoint \uD801" \ No newline at end of file From 85c38275bb1c071cacb7c29cb880d5ba2c349bc6 Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Sun, 18 Mar 2018 20:51:33 -0400 Subject: [PATCH 11/19] Forward slash is not an escapable character --- tests/invalid/string-bad-slash-escape.toml | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/invalid/string-bad-slash-escape.toml diff --git a/tests/invalid/string-bad-slash-escape.toml b/tests/invalid/string-bad-slash-escape.toml new file mode 100644 index 0000000..154abad --- /dev/null +++ b/tests/invalid/string-bad-slash-escape.toml @@ -0,0 +1 @@ +invalid-escape = "This string has a bad \/ escape character." From 38c213cd50769a8e0cf83625b756968b8137cdfe Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Mon, 19 Mar 2018 08:08:38 -0400 Subject: [PATCH 12/19] Underscores are allowed in numbers --- tests/valid/underscored-float.json | 3 +++ tests/valid/underscored-float.toml | 1 + tests/valid/underscored-integer.json | 3 +++ tests/valid/underscored-integer.toml | 1 + 4 files changed, 8 insertions(+) create mode 100644 tests/valid/underscored-float.json create mode 100644 tests/valid/underscored-float.toml create mode 100644 tests/valid/underscored-integer.json create mode 100644 tests/valid/underscored-integer.toml diff --git a/tests/valid/underscored-float.json b/tests/valid/underscored-float.json new file mode 100644 index 0000000..480109c --- /dev/null +++ b/tests/valid/underscored-float.json @@ -0,0 +1,3 @@ +{ + "electron_mass": {"type": "float", "value": "9.109109383e-31"} +} diff --git a/tests/valid/underscored-float.toml b/tests/valid/underscored-float.toml new file mode 100644 index 0000000..025b02a --- /dev/null +++ b/tests/valid/underscored-float.toml @@ -0,0 +1 @@ +electron_mass = 9_109.109_383e-3_4 diff --git a/tests/valid/underscored-integer.json b/tests/valid/underscored-integer.json new file mode 100644 index 0000000..0804919 --- /dev/null +++ b/tests/valid/underscored-integer.json @@ -0,0 +1,3 @@ +{ + "million": {"type": "integer", "value": "1000000"} +} diff --git a/tests/valid/underscored-integer.toml b/tests/valid/underscored-integer.toml new file mode 100644 index 0000000..6be8b51 --- /dev/null +++ b/tests/valid/underscored-integer.toml @@ -0,0 +1 @@ +million = 1_000_000 From d43e53d94569b9a3be0d350459ac5f9ef1b99f33 Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Mon, 2 Apr 2018 20:28:36 -0400 Subject: [PATCH 13/19] Inline table syntax --- tests/invalid/multi-line-inline-table.toml | 4 ++++ tests/valid/inline-table-array.json | 16 ++++++++++++++++ tests/valid/inline-table-array.toml | 3 +++ tests/valid/inline-table.json | 10 ++++++++++ tests/valid/inline-table.toml | 2 ++ 5 files changed, 35 insertions(+) create mode 100644 tests/invalid/multi-line-inline-table.toml create mode 100644 tests/valid/inline-table-array.json create mode 100644 tests/valid/inline-table-array.toml create mode 100644 tests/valid/inline-table.json create mode 100644 tests/valid/inline-table.toml diff --git a/tests/invalid/multi-line-inline-table.toml b/tests/invalid/multi-line-inline-table.toml new file mode 100644 index 0000000..a195e1b --- /dev/null +++ b/tests/invalid/multi-line-inline-table.toml @@ -0,0 +1,4 @@ +json_like = { + first = "Tom", + last = "Preston-Werner" +} \ No newline at end of file diff --git a/tests/valid/inline-table-array.json b/tests/valid/inline-table-array.json new file mode 100644 index 0000000..84df2da --- /dev/null +++ b/tests/valid/inline-table-array.json @@ -0,0 +1,16 @@ +{ + "people": [ + { + "first_name": {"type": "string", "value": "Bruce"}, + "last_name": {"type": "string", "value": "Springsteen"} + }, + { + "first_name": {"type": "string", "value": "Eric"}, + "last_name": {"type": "string", "value": "Clapton"} + }, + { + "first_name": {"type": "string", "value": "Bob"}, + "last_name": {"type": "string", "value": "Seger"} + } + ] +} diff --git a/tests/valid/inline-table-array.toml b/tests/valid/inline-table-array.toml new file mode 100644 index 0000000..3fa60d6 --- /dev/null +++ b/tests/valid/inline-table-array.toml @@ -0,0 +1,3 @@ +people = [{first_name = "Bruce", last_name = "Springsteen"}, + {first_name = "Eric", last_name = "Clapton"}, + {first_name = "Bob", last_name = "Seger"}] diff --git a/tests/valid/inline-table.json b/tests/valid/inline-table.json new file mode 100644 index 0000000..503b40c --- /dev/null +++ b/tests/valid/inline-table.json @@ -0,0 +1,10 @@ +{ + "name": { + "first": {"type": "string", "value": "Tom"}, + "last": {"type": "string", "value": "Preston-Werner"} + }, + "point": { + "x": {"type": "integer", "value": "1"}, + "y": {"type": "integer", "value": "2"} + } +} diff --git a/tests/valid/inline-table.toml b/tests/valid/inline-table.toml new file mode 100644 index 0000000..0bec07b --- /dev/null +++ b/tests/valid/inline-table.toml @@ -0,0 +1,2 @@ +name = { first = "Tom", last = "Preston-Werner" } +point = { x = 1, y = 2 } From 9ed09bfef6e8a4cc28589f4edf742aa14cef3291 Mon Sep 17 00:00:00 2001 From: Uiri Date: Tue, 3 Jul 2018 00:28:15 -0400 Subject: [PATCH 14/19] Close #26: Update README to TOML v0.4.0 This update more accurately reflects the current status of the test suite. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e7fb282..9c7331a 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ compared. Note though that encoders have their own set of invalid tests in the invalid-encoder directory. The JSON given to a TOML encoder is in the same format as the JSON that a TOML decoder should output. -Version: v0.2.0 (in sync with TOML) +Version: v0.4.0 (in sync with TOML) Compatible with TOML version -[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md) +[v0.4.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.4.0.md) Dependencies: [Go](http://golang.org). From 9043e87fe2577c7cedccd3fe1fd9267117ae0802 Mon Sep 17 00:00:00 2001 From: Uiri Date: Tue, 3 Jul 2018 00:54:49 -0400 Subject: [PATCH 15/19] Close #32: Add WTFPL License headers --- json.go | 7 +++++++ main.go | 7 +++++++ results.go | 7 +++++++ toml.go | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/json.go b/json.go index be89629..7b8b8bb 100644 --- a/json.go +++ b/json.go @@ -1,3 +1,10 @@ +/* + * This work is free. You can redistribute it and/or modify it under the + * terms of the Do What The Fuck You Want To Public License, Version 2, + * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ + * for more details. + */ + package main import ( diff --git a/main.go b/main.go index 8c0ea6d..a90bddf 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,10 @@ +/* + * This work is free. You can redistribute it and/or modify it under the + * terms of the Do What The Fuck You Want To Public License, Version 2, + * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ + * for more details. + */ + package main import ( diff --git a/results.go b/results.go index 9bae3bf..1a81a75 100644 --- a/results.go +++ b/results.go @@ -1,3 +1,10 @@ +/* + * This work is free. You can redistribute it and/or modify it under the + * terms of the Do What The Fuck You Want To Public License, Version 2, + * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ + * for more details. + */ + package main import ( diff --git a/toml.go b/toml.go index 13ec23e..9342dd1 100644 --- a/toml.go +++ b/toml.go @@ -1,3 +1,10 @@ +/* + * This work is free. You can redistribute it and/or modify it under the + * terms of the Do What The Fuck You Want To Public License, Version 2, + * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ + * for more details. + */ + package main import ( From 6aa27cde624b7f9b75385526c813abda5646275c Mon Sep 17 00:00:00 2001 From: Uiri Date: Tue, 3 Jul 2018 01:49:29 -0400 Subject: [PATCH 16/19] Revert "Allow Travis to go get (uiri's) repo" This reverts commit 34a3615c4bb8e1ba698faf25cf2c00549d630f5e. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index a90bddf..b12924b 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,7 @@ func init() { // If no test directory was specified, let's look for it automatically. // Assumes `toml-test` was installed with the Go tool. if len(flagTestdir) == 0 { - imp := path.Join("github.com", "uiri", "toml-test", "tests") + imp := path.Join("github.com", "BurntSushi", "toml-test", "tests") for _, dir := range build.Default.SrcDirs() { if readable(path.Join(dir, imp)) { flagTestdir = path.Join(dir, imp) From 1f3e067325b7882547ad88a9838a83d2223f09be Mon Sep 17 00:00:00 2001 From: sergio garcia Date: Sun, 15 Jul 2018 11:38:10 -0400 Subject: [PATCH 17/19] Use Z notation instead of +00:00 in json files --- README.md | 2 +- tests/valid/arrays.json | 6 +++--- tests/valid/datetime.json | 4 ++-- tests/valid/example.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1c58ddf..9de2b93 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ And the JSON encoding expected by `toml-test` is: ```json { - "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, + "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, "numtheory": { "boring": {"type": "bool", "value": "false"}, "perfection": { diff --git a/tests/valid/arrays.json b/tests/valid/arrays.json index 45b1f56..2445116 100644 --- a/tests/valid/arrays.json +++ b/tests/valid/arrays.json @@ -26,9 +26,9 @@ "dates": { "type": "array", "value": [ - {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, - {"type": "datetime", "value": "1979-05-27T07:32:00+00:00"}, - {"type": "datetime", "value": "2006-06-01T11:00:00+00:00"} + {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + {"type": "datetime", "value": "1979-05-27T07:32:00Z"}, + {"type": "datetime", "value": "2006-06-01T11:00:00Z"} ] }, "comments": { diff --git a/tests/valid/datetime.json b/tests/valid/datetime.json index 17a7060..4cdc000 100644 --- a/tests/valid/datetime.json +++ b/tests/valid/datetime.json @@ -1,5 +1,5 @@ { - "bestdayever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, - "numoffset": {"type": "datetime", "value": "1977-06-28T12:32:00+00:00"}, + "bestdayever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, + "numoffset": {"type": "datetime", "value": "1977-06-28T12:32:00Z"}, "milliseconds": {"type": "datetime", "value": "1977-12-21T03:32:00.555+00:00"} } diff --git a/tests/valid/example.json b/tests/valid/example.json index 33d1a7c..48aa907 100644 --- a/tests/valid/example.json +++ b/tests/valid/example.json @@ -1,5 +1,5 @@ { - "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00+00:00"}, + "best-day-ever": {"type": "datetime", "value": "1987-07-05T17:45:00Z"}, "numtheory": { "boring": {"type": "bool", "value": "false"}, "perfection": { From fb20d7aa743e57f1630718da839a6c069005ce4d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Mon, 30 Jul 2018 15:42:54 -0400 Subject: [PATCH 18/19] relicense to MIT *sigh* --- COPYING | 27 +++++++++++++++++---------- json.go | 7 ------- main.go | 11 ++--------- results.go | 7 ------- toml.go | 7 ------- 5 files changed, 19 insertions(+), 40 deletions(-) diff --git a/COPYING b/COPYING index 5a8e332..93b2202 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1,21 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 +The MIT License (MIT) - Copyright (C) 2004 Sam Hocevar +Copyright (c) 2018 TOML authors - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/json.go b/json.go index 7b8b8bb..be89629 100644 --- a/json.go +++ b/json.go @@ -1,10 +1,3 @@ -/* - * This work is free. You can redistribute it and/or modify it under the - * terms of the Do What The Fuck You Want To Public License, Version 2, - * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ - * for more details. - */ - package main import ( diff --git a/main.go b/main.go index b12924b..d69c23e 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,3 @@ -/* - * This work is free. You can redistribute it and/or modify it under the - * terms of the Do What The Fuck You Want To Public License, Version 2, - * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ - * for more details. - */ - package main import ( @@ -75,8 +68,8 @@ func usage() { path.Base(os.Args[0])) log.Println(` parser-cmd should be a program that accepts TOML data on stdin until EOF, -and outputs the corresponding JSON encoding on stdout. Please see 'README.md' -for details on how to satisfy the interface expected by 'toml-test' with your +and outputs the corresponding JSON encoding on stdout. Please see 'README.md' +for details on how to satisfy the interface expected by 'toml-test' with your own parser. The 'testdir' directory should have two sub-directories: 'invalid' and 'valid'. diff --git a/results.go b/results.go index 1a81a75..9bae3bf 100644 --- a/results.go +++ b/results.go @@ -1,10 +1,3 @@ -/* - * This work is free. You can redistribute it and/or modify it under the - * terms of the Do What The Fuck You Want To Public License, Version 2, - * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ - * for more details. - */ - package main import ( diff --git a/toml.go b/toml.go index 9342dd1..13ec23e 100644 --- a/toml.go +++ b/toml.go @@ -1,10 +1,3 @@ -/* - * This work is free. You can redistribute it and/or modify it under the - * terms of the Do What The Fuck You Want To Public License, Version 2, - * as published by Sam Hocevar. See the COPYING file or http://www.wtfpl.net/ - * for more details. - */ - package main import ( From df90d31f2f731c0f28ffeceb8a75361bc0b99c00 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Mon, 3 Sep 2018 16:09:09 -0700 Subject: [PATCH 19/19] Add @iarna/toml to list of satisfying parsers I also produce https://shared.by.re-becca.org/misc/TOML-SPEC-SUPPORT.html, showing how the various actively developed JS parsers compare (which is why I use my own harness). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c7331a..a252c43 100644 --- a/README.md +++ b/README.md @@ -233,4 +233,4 @@ messages. * Julia (@pygy) - https://github.com/pygy/TOML.jl * PHP (@yosymfony) - https://github.com/yosymfony/toml * Python (@f03lipe) - https://github.com/f03lipe/toml-python - +* JavaScript (@iarna) - https://github.com/iarna/iarna-toml