smol-toml version 7eac80f
FAIL invalid/datetime/feb-29
Expected an error, but no error was reported.
input sent to parser-cmd:
"not a leap year" = 2100-02-29T15:15:15Z
output from parser-cmd (stdout):
{
"not a leap year": {"type": "datetime", "value": "2100-03-01T15:15:15.000Z"}
}
want:
Exit code 1
FAIL invalid/datetime/feb-30
Expected an error, but no error was reported.
input sent to parser-cmd:
"only 28 or 29 days in february" = 1988-02-30T15:15:15Z
output from parser-cmd (stdout):
{
"only 28 or 29 days in february": {"type": "datetime", "value": "1988-03-01T15:15:15.000Z"}
}
want:
Exit code 1
FAIL invalid/datetime/offset-overflow-hour
Expected an error, but no error was reported.
input sent to parser-cmd:
# Hour must be 00-24
d = 1985-06-18 17:04:07+25:00
output from parser-cmd (stdout):
{
"d": {"type": "datetime", "value": "1985-06-18T17:04:07.000+25:00"}
}
want:
Exit code 1
FAIL invalid/encoding/bad-codepoint
Expected an error, but no error was reported.
input sent to parser-cmd:
# Invalid codepoint U+D800 : í €
output from parser-cmd (stdout):
{}
want:
Exit code 1
FAIL invalid/encoding/bad-utf8-in-comment
Expected an error, but no error was reported.
input sent to parser-cmd:
# Ã
output from parser-cmd (stdout):
{}
want:
Exit code 1
FAIL invalid/encoding/bad-utf8-in-multiline
Expected an error, but no error was reported.
input sent to parser-cmd:
# The following line contains an invalid UTF-8 sequence.
bad = """Ã"""
output from parser-cmd (stdout):
{
"bad": {"type": "string", "value": "�"}
}
want:
Exit code 1
FAIL invalid/encoding/bad-utf8-in-multiline-literal
Expected an error, but no error was reported.
input sent to parser-cmd:
# The following line contains an invalid UTF-8 sequence.
bad = '''Ã'''
output from parser-cmd (stdout):
{
"bad": {"type": "string", "value": "�"}
}
want:
Exit code 1
FAIL invalid/encoding/bad-utf8-in-string
Expected an error, but no error was reported.
input sent to parser-cmd:
# The following line contains an invalid UTF-8 sequence.
bad = "Ã"
output from parser-cmd (stdout):
{
"bad": {"type": "string", "value": "�"}
}
want:
Exit code 1
FAIL invalid/encoding/bad-utf8-in-string-literal
Expected an error, but no error was reported.
input sent to parser-cmd:
# The following line contains an invalid UTF-8 sequence.
bad = 'Ã'
output from parser-cmd (stdout):
{
"bad": {"type": "string", "value": "�"}
}
want:
Exit code 1
FAIL invalid/local-date/feb-29
Expected an error, but no error was reported.
input sent to parser-cmd:
"not a leap year" = 2100-02-29
output from parser-cmd (stdout):
{
"not a leap year": {"type": "date-local", "value": "2100-03-01"}
}
want:
Exit code 1
FAIL invalid/local-date/feb-30
Expected an error, but no error was reported.
input sent to parser-cmd:
"only 28 or 29 days in february" = 1988-02-30
output from parser-cmd (stdout):
{
"only 28 or 29 days in february": {"type": "date-local", "value": "1988-03-01"}
}
want:
Exit code 1
FAIL invalid/local-datetime/feb-29
Expected an error, but no error was reported.
input sent to parser-cmd:
"not a leap year" = 2100-02-29T15:15:15
output from parser-cmd (stdout):
{
"not a leap year": {"type": "datetime-local", "value": "2100-03-01T15:15:15.000"}
}
want:
Exit code 1
FAIL invalid/local-datetime/feb-30
Expected an error, but no error was reported.
input sent to parser-cmd:
"only 28 or 29 days in february" = 1988-02-30T15:15:15
output from parser-cmd (stdout):
{
"only 28 or 29 days in february": {"type": "datetime-local", "value": "1988-03-01T15:15:15.000"}
}
want:
Exit code 1
FAIL invalid/string/bad-uni-esc-6
Expected an error, but no error was reported.
input sent to parser-cmd:
bad-uni-esc-6 = "This string contains a non scalar unicode codepoint \uD801"
output from parser-cmd (stdout):
{
"bad-uni-esc-6": {"type": "string", "value": "This string contains a non scalar unicode codepoint �"}
}
want:
Exit code 1
toml-test v2024-05-31 [./src/js-smol-toml/toml-test-parse.mjs]: using embedded tests, 1 skipped
valid tests: 181 passed, 0 failed
invalid tests: 357 passed, 14 failed
==> ENCODER TESTS
FAIL valid/comment/tricky
Values for key "section.ten" differ:
Expected: 1000 (float64)
Your encoder: 1000 (int64)
input sent to parser-cmd:
{
"hash#tag": {
"#!": {"type": "string", "value": "hash bang"},
"arr5": [[[[[{"type": "string", "value": "#"}]]]]],
"arr3": [
{"type": "string", "value": "#"},
{"type": "string", "value": "#"},
{"type": "string", "value": "###"}
],
"arr4": [
{"type": "integer", "value": "1"},
{"type": "integer", "value": "2"},
{"type": "integer", "value": "3"},
{"type": "integer", "value": "4"}
],
"tbl1": {
"#": {"type": "string", "value": "}#"}
}
},
"section": {
"8": {"type": "string", "value": "eight"},
"eleven": {"type": "float", "value": "11.1"},
"five": {"type": "float", "value": "5.5"},
"four": {"type": "string", "value": "# no comment\n# nor this\n#also not comment"},
"one": {"type": "string", "value": "11"},
"six": {"type": "integer", "value": "6"},
"ten": {"type": "float", "value": "1000.0"},
"three": {"type": "string", "value": "#"},
"two": {"type": "string", "value": "22#"}
}
}
output from parser-cmd (stdout):
["hash#tag"]
"#!" = "hash bang"
arr5 = [ [ [ [ [ "#" ] ] ] ] ]
arr3 = [ "#", "#", "###" ]
arr4 = [ 1, 2, 3, 4 ]
["hash#tag".tbl1]
"#" = "}#"
[section]
8 = "eight"
eleven = 11.1
five = 5.5
four = "# no comment\n# nor this\n#also not comment"
one = "11"
six = 6
ten = 1000
three = "#"
two = "22#"
want:
[section]#attached comment
#[notsection]
one = "11"#cmt
two = "22#"
three = '#'
four = """# no comment
# nor this
#also not comment"""#is_comment
five = 5.5#66
six = 6#7
8 = "eight"
#nine = 99
ten = 10e2#1
eleven = 1.11e1#23
["hash#tag"]
"#!" = "hash bang"
arr3 = [ "#", '#', """###""" ]
arr4 = [ 1,# 9, 9,
2#,9
,#9
3#]
,4]
arr5 = [[[[#["#"],
["#"]]]]#]
]
tbl1 = { "#" = '}#'}#}}
FAIL valid/float/exponent
Values for key "lower" differ:
Expected: 300 (float64)
Your encoder: 300 (int64)
input sent to parser-cmd:
{
"lower": {"type": "float", "value": "300.0"},
"minustenth": {"type": "float", "value": "-0.1"},
"neg": {"type": "float", "value": "0.03"},
"pointlower": {"type": "float", "value": "310.0"},
"pointupper": {"type": "float", "value": "310.0"},
"pos": {"type": "float", "value": "300.0"},
"upper": {"type": "float", "value": "300.0"},
"zero": {"type": "float", "value": "3.0"}
}
output from parser-cmd (stdout):
lower = 300
minustenth = -0.1
neg = 0.03
pointlower = 310
pointupper = 310
pos = 300
upper = 300
zero = 3
want:
lower = 3e2
upper = 3E2
neg = 3e-2
pos = 3E+2
zero = 3e0
pointlower = 3.1e2
pointupper = 3.1E2
minustenth = -1E-1
FAIL valid/float/max-int
Values for key "max_float" differ:
Expected: 9007199254740991 (float64)
Your encoder: 9007199254740991 (int64)
input sent to parser-cmd:
{
"max_float": {"type": "float", "value": "9007199254740991"},
"min_float": {"type": "float", "value": "-9007199254740991"}
}
output from parser-cmd (stdout):
max_float = 9007199254740991
min_float = -9007199254740991
want:
# Maximum and minimum safe natural numbers.
max_float = 9_007_199_254_740_991.0
min_float = -9_007_199_254_740_991.0
FAIL valid/float/underscore
Values for key "exponent" differ:
Expected: 300000000000000 (float64)
Your encoder: 300000000000000 (int64)
input sent to parser-cmd:
{
"after": {"type": "float", "value": "3141.5927"},
"before": {"type": "float", "value": "3141.5927"},
"exponent": {"type": "float", "value": "3.0e14"}
}
output from parser-cmd (stdout):
after = 3141.5927
before = 3141.5927
exponent = 300000000000000
want:
before = 3_141.5927
after = 3141.592_7
exponent = 3e1_4
FAIL valid/float/zero
Values for key "exponent" differ:
Expected: 0 (float64)
Your encoder: 0 (int64)
input sent to parser-cmd:
{
"exponent": {"type": "float", "value": "0"},
"exponent-signed-neg": {"type": "float", "value": "-0"},
"exponent-signed-pos": {"type": "float", "value": "0"},
"exponent-two-0": {"type": "float", "value": "0"},
"signed-neg": {"type": "float", "value": "-0"},
"signed-pos": {"type": "float", "value": "0"},
"zero": {"type": "float", "value": "0"}
}
output from parser-cmd (stdout):
exponent = 0
exponent-signed-neg = 0
exponent-signed-pos = 0
exponent-two-0 = 0
signed-neg = 0
signed-pos = 0
zero = 0
want:
zero = 0.0
signed-pos = +0.0
signed-neg = -0.0
exponent = 0e0
exponent-two-0 = 0e00
exponent-signed-pos = +0e0
exponent-signed-neg = -0e0
FAIL valid/inline-table/spaces
Values for key "clap-2.nest.b" differ:
Expected: 9 (float64)
Your encoder: 9 (int64)
input sent to parser-cmd:
{
"clap-1": {
"version": {"type": "string", "value": "4"},
"features": [
{"type": "string", "value": "derive"},
{"type": "string", "value": "cargo"}
]
},
"clap-2": {
"version": {"type": "string", "value": "4"},
"features": [
{"type": "string", "value": "derive"},
{"type": "string", "value": "cargo"}
],
"nest": {
"a": {"type": "string", "value": "x"},
"b": [
{"type": "float", "value": "1.5"},
{"type": "float", "value": "9"}
]
}
}
}
output from parser-cmd (stdout):
[clap-1]
version = "4"
features = [ "derive", "cargo" ]
[clap-2]
version = "4"
features = [ "derive", "cargo" ]
[clap-2.nest]
a = "x"
b = [ 1.5, 9 ]
want:
# https://github.com/toml-lang/toml-test/issues/146
clap-1 = { version = "4" , features = ["derive", "cargo"] }
# Contains some literal tabs!
clap-2 = { version = "4" , features = [ "derive" , "cargo" ] , nest = { "a" = 'x' , 'b' = [ 1.5 , 9.0 ] } }
FAIL valid/spec/float-0
Values for key "flt1" differ:
Expected: 1 (float64)
Your encoder: 1 (int64)
input sent to parser-cmd:
{
"flt1": {"type": "float", "value": "1"},
"flt2": {"type": "float", "value": "3.1415"},
"flt3": {"type": "float", "value": "-0.01"},
"flt4": {"type": "float", "value": "5e+22"},
"flt5": {"type": "float", "value": "1e+06"},
"flt6": {"type": "float", "value": "-0.02"},
"flt7": {"type": "float", "value": "6.626e-34"}
}
output from parser-cmd (stdout):
flt1 = 1
flt2 = 3.1415
flt3 = -0.01
flt4 = 5e+22
flt5 = 1000000
flt6 = -0.02
flt7 = 6.626e-34
want:
# fractional
flt1 = +1.0
flt2 = 3.1415
flt3 = -0.01
# exponent
flt4 = 5e+22
flt5 = 1e06
flt6 = -2E-2
# both
flt7 = 6.626e-34
toml-test v2024-05-31 [./src/js-smol-toml/toml-test-encode.mjs]: using embedded tests, 1 skipped
encoder tests: 174 passed, 7 failed
took (error) (error)