diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-05-16 00:08:00 +0930 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-05-16 00:08:00 +0930 |
commit | 2cb7a17e3e5a0bab761661e193ffbea146dade73 (patch) | |
tree | 0da314b86023464d9e68070869004e8851cffb5f /tests/test.lua | |
parent | 35e81a9c4143890771553c38dce0719630b37517 (diff) | |
download | lua-cjson-2cb7a17e3e5a0bab761661e193ffbea146dade73.tar.gz lua-cjson-2cb7a17e3e5a0bab761661e193ffbea146dade73.tar.bz2 lua-cjson-2cb7a17e3e5a0bab761661e193ffbea146dade73.zip |
Warn that a failed NaN test may not be an error
Sprintf returns "-nan" rather than "nan" on some platforms, which causes
the test script to incorrectly flag a failure.
Also allow test functions without "==> Config" output.
Diffstat (limited to 'tests/test.lua')
-rwxr-xr-x | tests/test.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test.lua b/tests/test.lua index bfa4f66..19f5eca 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -147,9 +147,13 @@ local encode_error_tests = { | |||
147 | false, { "Cannot serialise number: must not be NaN or Inf" } }, | 147 | false, { "Cannot serialise number: must not be NaN or Inf" } }, |
148 | function () | 148 | function () |
149 | json.refuse_invalid_numbers(false) | 149 | json.refuse_invalid_numbers(false) |
150 | return 'Setting refuse_invalid_numbers(false)' | 150 | return 'Setting refuse_invalid_numbers(false).' |
151 | end, | 151 | end, |
152 | { json.encode, { NaN }, true, { "-nan" } }, | 152 | function () |
153 | print('NOTE: receiving "-nan" is ok..') | ||
154 | return | ||
155 | end, | ||
156 | { json.encode, { NaN }, true, { "nan" } }, | ||
153 | { json.encode, { Inf }, true, { "inf" } }, | 157 | { json.encode, { Inf }, true, { "inf" } }, |
154 | function () | 158 | function () |
155 | json.refuse_invalid_numbers("encode") | 159 | json.refuse_invalid_numbers("encode") |