diff options
author | Mark Pulford <mark@kyne.com.au> | 2011-12-30 14:17:44 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2011-12-30 14:17:44 +1030 |
commit | 2416b145073211b840781da6abf4b6d97f4657a6 (patch) | |
tree | 6e92a13a7cc8ef8357245bc3ef320f5841350991 /tests | |
parent | 6cc88e3ac5275868e168acaf60203563f131355b (diff) | |
download | lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.gz lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.tar.bz2 lua-cjson-2416b145073211b840781da6abf4b6d97f4657a6.zip |
Add fpconv to work around comma decimal points
Create a separate buffer and translate comma <> dot before calling
strtod(), and after calling sprintf() as required.
- Add "update_locale" Lua API call and init locale on module load.
- Move sprintf format string to fpconv
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua index bb696a2..bdae6ea 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -211,12 +211,14 @@ local escape_tests = { | |||
211 | local locale_tests = { | 211 | local locale_tests = { |
212 | function () | 212 | function () |
213 | os.setlocale("cs_CZ") | 213 | os.setlocale("cs_CZ") |
214 | cjson.update_locale() | ||
214 | return "Setting locale to cs_CZ (comma separator)" | 215 | return "Setting locale to cs_CZ (comma separator)" |
215 | end, | 216 | end, |
216 | { json.encode, { 1.5 }, true, { '1.5' } }, | 217 | { json.encode, { 1.5 }, true, { '1.5' } }, |
217 | { json.decode, { "[ 10, \"test\" ]" }, true, { { 10, "test" } } }, | 218 | { json.decode, { "[ 10, \"test\" ]" }, true, { { 10, "test" } } }, |
218 | function () | 219 | function () |
219 | os.setlocale("C") | 220 | os.setlocale("C") |
221 | cjson.update_locale() | ||
220 | return "Reverting locale to POSIX" | 222 | return "Reverting locale to POSIX" |
221 | end | 223 | end |
222 | } | 224 | } |