Diagnostics/Scribunto/Luaj

From XOWA: the free, open-source, offline wiki application

Luaj

2.0.3 errors fixed in 3.0

name code actl rslt
pass string.format fails for bad format; fails with "" {{#invoke:Diagnostics/Luaj|string_format_2|%d:%02.f|3|4}} 3:04


pass os.time does not handle dates before 1970 on Windows; fails with false on Windows
NOTE: always fails on Windows with the lua engine
{{#invoke:Diagnostics/Luaj|os_time|1234|05|06}} true


pass pairs.next fails when setting val to null; fails with "" {{#invoke:Diagnostics/Luaj|pairs_next}} ok


2.0.3 features removed from 3.0

name code actl rslt
pass string.gfind deprecated; should be alias to gmatch; fails with "" {{#invoke:Diagnostics/Luaj|string_gfind|ab cd|%w+}} ab


pass tonumber returns original value if value has decimal and base is 10; fails with "" {{#invoke:Diagnostics/Luaj|tonumber|12.34|10}} 12.34


pass tonumber('-') should be nil not 0 {{#invoke:Diagnostics/Luaj|tonumber_lone|-}}


pass math.log10 deprecated; now calls Math.log10; fails with "" {{#invoke:Diagnostics/Luaj|math_log10|100}} 2


pass math.mod deprecated; now aliased to math.fmod; fails with "" {{#invoke:Diagnostics/Luaj|math_mod|3|2}} 1


pass table.maxn deprecated; fails with "" {{#invoke:Diagnostics/Luaj|table_maxn}} 3


pass table.getn deprecated -- key_is_num; fails with "" {{#invoke:Diagnostics/Luaj|table_getn__key_is_num}} 3


pass table.getn deprecated -- key_is_str; fails with "" {{#invoke:Diagnostics/Luaj|table_getn__key_is_str}} 0


pass automatic arg variable in varargs function deprecated; fails with "" {{#invoke:Diagnostics/Luaj|varargs_arg}} a


3.0 defects

name code actl rslt
pass tonumber should trim all white space, not just \s; fails with "" {{#invoke:Diagnostics/Luaj|value_tonumber_trim}} 123


pass string.rep fails if negative repetition; return ""; fails with "" {{#invoke:Diagnostics/Luaj|string_rep_test|a|-1}} pass:


pass string.gsub fails with ArrayIndexOutOfBoundsException; check for OutOfBounds; fails with "" {{#invoke:Diagnostics/Luaj|string_gsub|a#b|#|}} ab


pass string.gsub fails if src is empty string; exit early if empty; fails with "" {{#invoke:Diagnostics/Luaj|string_gsub||%b<>|}}


pass string.gmatch: non-match {{#invoke:Diagnostics/Luaj|string_gmatch|a|[^,]*}} a;;


pass string.gmatch: match {{#invoke:Diagnostics/Luaj|string_gmatch|a,b|[^,]*}} a;;b;;


pass string.gmatch: convert example; plain text {{#invoke:Diagnostics/Luaj|string_gmatch_convert|a}}


pass string.gmatch: convert example; lnki {{#invoke:Diagnostics/Luaj|string_gmatch_convert|[[a]]}}


pass string.format does not use format args for double; call java.lang.String.format; fails with 1.234 {{#invoke:Diagnostics/Luaj|string_format|%.1f|1.234}} 1.2


pass string.format fails for bad format; fails with "" {{#invoke:Diagnostics/Luaj|string_format|(%0.1f%%)|1.234}} (1.2%)


pass string.format fails if no number after "."; fails with "" {{#invoke:Diagnostics/Luaj|string_format|%02.f|3}} 03


pass string.format fails for char; fails with "" {{#invoke:Diagnostics/Luaj|string_format|%c|97}} a


pass string.format fails for multibyte chars; fails with "" {{#invoke:Diagnostics/Luaj|string_format|âbç%f|1}} âbç1.0


pass multibyte strings not supported; fails with "" {{#invoke:Diagnostics/Luaj|string_multibyte_2}} â


pass multibyte strings not supported; fails with "" {{#invoke:Diagnostics/Luaj|string_multibyte_3}} อา


pass multibyte chars in lua variables; used to return "?" {{#invoke:Diagnostics/Luaj|ustring_match_multibyte|𠀀}} 𠀀


pass handle backslash-escaped sequences like \239\191\185; used to return "11" {{#invoke:Diagnostics/Luaj|multibyte__backslash_escaped}}


pass surrogate pair chars not supported; fails with "" {{#invoke:Diagnostics/Luaj|string_surrogate_pair}} 1


pass table.concat fails if end is nil; convert nil to list len; fails with "" {{#invoke:Diagnostics/Luaj|table_concat|.|1||a|b|c}} a.b.c


pass table.concat fails if sep is nil; convert nil to ""; fails with "" {{#invoke:Diagnostics/Luaj|table_concat_nil_sep}} ab


pass table.concat fails if 1st argument is nil; fails with "bad argument: string expected, got nil" {{#invoke:Diagnostics/Luaj|table_remove_nil_arg_at_pos_1}} ab


pass os_date does not accept utc argument; fails with ""
NOTE: test assumes EST / EDT; if ! is not applied, then date would be 1969-12-31
{{#invoke:Diagnostics/Luaj|os_date|!*t|3600}} 1970-01-01


pass os_date non-utc check; {{#invoke:Diagnostics/Luaj|os_date|*t|0}} 1969-12-31


pass os_date format: %e; fails with ""; NOTE: test assumes time zone within 11 hours of UTC {{#invoke:Diagnostics/Luaj|os_date_format|%e|2014|07|15|1|2|3}} 15


pass os_date format: %R; fails with "" {{#invoke:Diagnostics/Luaj|os_date_format|%R|2014|07|15|13|2|3}} 13:02


pass match.balanced: fails with out of bounds; {{#invoke:Diagnostics/Luaj|string_match|a|%b()}}


pass match.balanced: fails with out of bounds; ^ at beginning {{#invoke:Diagnostics/Luaj|string_match|a|^(.) ?%b()}}


pass match.frontier:error {{#invoke:Diagnostics/Luaj|string_gmatch|a|%f[%a]b}}


pass match.frontier:bad-implementation; used to return "" {{#invoke:Diagnostics/Luaj|lua_match|bz|%f[%a][%a]z$}} bz


pass tonumber hex fails if incomplete {{#invoke:Diagnostics/Luaj|tonumber_hex|0x}}


pass tonumber hex check {{#invoke:Diagnostics/Luaj|tonumber_hex|0xFF}} 255


pass string.gsub does not match $ at end of string {{#invoke:Diagnostics/Luaj|string_gsub|ab|e?$|1}} abe


pass table.unpack does not handle nil args; fails with error {{#invoke:Diagnostics/Luaj|table_unpack_nil}} a,b,c,d


pass surrogate pairs not handled correctly; fails with wrong 1st char: 𢱌 {{#invoke:Diagnostics/Luaj|core_surrogate_pairs}} 𣂁 - 脁 - 晁


pass zero-length regex fails {{#invoke:Diagnostics/Luaj|lua_match|text|}}


pass utf-8 char fails {{#invoke:Diagnostics/Luaj|var|â|}} â


pass fails if "2." is coerced to 2 {{#invoke:Diagnostics/Luaj|table_overwrite_int_with_string}} 2.


pass fails if "a1" {{#invoke:Diagnostics/Luaj|loadDataTest}} pass1


Namespaces

XOWA

Getting started

Android

Help

Blog

Donate