Diagnostics/Scribunto/All

From XOWA: the free, open-source, offline wiki application
  • Note: This is not a comprehensive testing of all functions. (i.e.: there are some working functions that are not listed below)

Basic

name code actl rslt
Init; Load; executeFunctionChunk {{#invoke:Diagnostics/Basic|print}} print pass
new line behavior {{#invoke:Diagnostics/Basic|new_line}} a

b

pass

Lua Common

name code actl rslt
getExpandedArgument {{#invoke:Diagnostics/LuaCommon|getExpandedArgument_number_2 |val_1|val_2}} arg_1 is 'val_1'; arg_2 is 'val_2' pass
getExpandedArgument_byOrdinal {{#invoke:Diagnostics/LuaCommon|getExpandedArgument_by_ordinal |key_1=val_1|val_2}} [1] is 'val_2' pass
getAllExpandedArguments {{#invoke:Diagnostics/LuaCommon|getAllExpandedArguments |val_1|val_2|val_3}} 1:val_1;2:val_2;3:val_3; pass
getAllExpandedArgs;key_is_int {{#invoke:Diagnostics/LuaCommon|getAllExpandedArguments_int_key|1=a}} a pass
preprocess;redundant_keys {{#invoke:Diagnostics/LuaCommon|preprocess_ifeq_as_yn |val_1|val_1|when_true_val=y1|when_false_val=n1|when_true_val=y2}} y2 pass
expandTemplate {{#invoke:Diagnostics/LuaCommon|expandTemplate|val_1|val_2}} arg_1 is val_1; arg_2 is val_2 pass
expandTemplate; PHP bool {{#invoke:Diagnostics/LuaCommon|expandTemplate_bool}} bool_true is '1'; bool_false is 'missing';


pass
callParserFunction {{#invoke:Diagnostics/LuaCommon|callParserFunction|urlencode|abc}} abc pass
isSubsting;false {{#invoke:Diagnostics/LuaCommon|isSubsting}} false pass
isSubsting;true {{safesubst:#invoke:Diagnostics/LuaCommon|isSubsting}} true pass
getFrameTitle_current {{#invoke:Diagnostics/LuaCommon|getFrameTitle_current}} Module:Diagnostics/LuaCommon pass
getFrameTitle_parent {{Diagnostics/LuaCommon/getFrameTitle_parent}} Template:Diagnostics/LuaCommon/getFrameTitle parent pass
getFrameTitle_parent.upper {{diagnostics/LuaCommon/getFrameTitle_parent}} Template:Diagnostics/LuaCommon/getFrameTitle parent pass
newChildFrame.title {{#invoke:Diagnostics/LuaCommon|newChildFrame_titled}} title:Title0; arg1:v1 pass
newChildFrame.title {{#invoke:Diagnostics/LuaCommon|newChildFrame_untitled}} title:Module:Diagnostics/LuaCommon; arg1:v1 pass
preprocess_args;frame is current {{#invoke:Diagnostics/LuaCommon|preprocess_args_current|match|y|n}} y pass
preprocess_args;frame is parent {{Diagnostics/LuaCommon/preprocess_args_parent|match|y|n}} y pass

Ustring Library

name code actl rslt
match (via trim) {{#invoke:Diagnostics/UstringLibrary|match| a b c |^%s*(.-)%s*$}} a b c pass
match error; only regx passed {{#invoke:Diagnostics/UstringLibrary|match_error__regx_only}} pass
gsub;replacement is string {{#invoke:Diagnostics/UstringLibrary|gsub_string|abcabc|[a]|A}} AbcAbc pass
gsub;replacement is table {{#invoke:Diagnostics/UstringLibrary|gsub_table}} AbCAbC pass
gsub;replacement is function (lua); basic {{#invoke:Diagnostics/UstringLibrary|gsub_function_lua_basic}} AbcAbc pass
gsub;replacement is function (lua); grouping {{#invoke:Diagnostics/UstringLibrary|gsub_function_lua_grouping}} AbcAbc pass
gsub;balanced group;
(will fail on Java 1.6, but not on Java 1.7+)
{{#invoke:Diagnostics/UstringLibrary|gsub_string |(a)|%b()|c}} c pass
gsub;regex with %W;
(will fail on Java 1.6, but not on Java 1.7+)
{{#invoke:Diagnostics/UstringLibrary|gsub_string|[a]|[%W]|-}} -a- pass
gmatch_init and gmatch_callback (via gmatch) {{#invoke:Diagnostics/UstringLibrary|gmatch|abcabc|a(b)}} b,;b,; pass
gsub; non-ASCII
(will print unrecognizable character)
{{#invoke:Diagnostics/UstringLibrary|gsub_string|bß|[a]ß|c}} pass

Uri Library

name code actl rslt
anchorEncode {{#invoke:Diagnostics/UriLibrary|anchorEncode|[irc://a b c]}} b_c pass
localUrl {{#invoke:Diagnostics/UriLibrary|localUrl|a&b! c}} /wiki/A%26b!_c pass
fullUrl {{#invoke:Diagnostics/UriLibrary|fullUrl|a&b! c}} //home/wiki/A%26b!_c pass
defaultUrl {{#invoke:Diagnostics/UriLibrary|defaultUrl}} //home/wiki/Diagnostics/Scribunto/All pass

Language Library

name code actl rslt
getContLangCode (by getContentLanguage) {{#invoke:Diagnostics/LanguageLibrary|getContLangCode}} en pass
isKnownLanguageTag; true {{#invoke:Diagnostics/LanguageLibrary|isKnownLanguageTag|en}} true pass
isKnownLanguageTag; false {{#invoke:Diagnostics/LanguageLibrary|isKnownLanguageTag|xyz}} false pass
isValidCode; true {{#invoke:Diagnostics/LanguageLibrary|isValidCode|en}} true pass
isValidCode; false {{#invoke:Diagnostics/LanguageLibrary|isValidCode|a[b}} false pass
isValidBuiltInCode; true {{#invoke:Diagnostics/LanguageLibrary|isValidBuiltInCode|en}} true pass
isValidBuiltInCode; false {{#invoke:Diagnostics/LanguageLibrary|isValidBuiltInCode|a#b}} false pass
fetchLanguageName; code only {{#invoke:Diagnostics/LanguageLibrary|fetchLanguageName|en|en}} English pass
fetchLanguageNames_get {{#invoke:Diagnostics/LanguageLibrary|fetchLanguageNames_get|fr}} French pass
new {{#invoke:Diagnostics/LanguageLibrary|new_lang_code|fr}} fr pass
formatNum; en {{#invoke:Diagnostics/LanguageLibrary|formatNum|1234}} 1,234 pass
parseFormatteNum; en {{#invoke:Diagnostics/LanguageLibrary|parseFormattedNum|1,234}} 1,234 pass
formatDate via pcall; y; {{#invoke:Diagnostics/LanguageLibrary|formatDate_valid|Y-m-d|2014-03-25}} y pass
formatDate via pcall; n; {{#invoke:Diagnostics/LanguageLibrary|formatDate_valid|Y-m-d|fail}} n pass
convertGrammar {{#invoke:Diagnostics/LanguageLibrary|convertGrammar|fi|talo|elative}} talosta pass
isRTL; en {{#invoke:Diagnostics/LanguageLibrary|isRTL|en}} false pass
isRTL; ar {{#invoke:Diagnostics/LanguageLibrary|isRTL|ar}} true pass
format_durations_hms {{#invoke:Diagnostics/LanguageLibrary|format_durations_hms|123}} 2 minutes and 3 seconds pass
get_duration_intervals_hms {{#invoke:Diagnostics/LanguageLibrary|get_duration_intervals_hms|123}} ,2,3 pass

Site Library

name code actl rslt
siteName {{#invoke:Diagnostics/SiteLibrary|siteName}} home pass
ns_name {{#invoke:Diagnostics/SiteLibrary|ns_associated|Help}} Help talk pass

Title Library

name code actl rslt
newTitle {{#invoke:Diagnostics/TitleLibrary|newTitle|Main_Page}} Main Page pass
newTitle; namespace arg {{#invoke:Diagnostics/TitleLibrary|newTitle|Contents|Help}} Help:Contents pass
makeTitle {{#invoke:Diagnostics/TitleLibrary|makeTitle|Help|Contents|Overview|home}} home:Help:Contents#Overview pass
fullUrl {{#invoke:Diagnostics/TitleLibrary|fullUrl|Help|Contents}} //home/wiki/Help:Contents pass
getCurrentTitle {{#invoke:Diagnostics/TitleLibrary|getCurrentTitle}} Diagnostics/Scribunto/All pass

Text Library

name code actl rslt
init_text_for_wiki (via listToText) {{#invoke:Diagnostics/TextLibrary|listToText|a|b|c}} a, b and c pass
unstrip {{#invoke:Diagnostics/TextLibrary|unstrip|abc}} abc pass
getEntityTable (via decode) {{#invoke:Diagnostics/TextLibrary|decode|gt;}} > pass

HTML Library

name code actl rslt
create {{#invoke:Diagnostics/HtmlLibrary|create_span}} span pass

Message Library

name code actl rslt
init_message_for_lang (via getDefaultLanguage) {{#invoke:Diagnostics/MessageLibrary|getDefaultLanguage}} en pass
plain {{#invoke:Diagnostics/MessageLibrary|plain|mainpage}} Main Page pass
plain; params {{#invoke:Diagnostics/MessageLibrary|plain|redirectedfrom|A}} (Redirected from A) pass
exists; true {{#invoke:Diagnostics/MessageLibrary|check|exists|sun}} true pass
exists; false {{#invoke:Diagnostics/MessageLibrary|check|exists|sunx}} false pass
isBlank; false {{#invoke:Diagnostics/MessageLibrary|check|isBlank|sun}} false pass
isDisabled; false {{#invoke:Diagnostics/MessageLibrary|check|isDisabled|sun}} false pass
inLanguage {{#invoke:Diagnostics/MessageLibrary|plain_inLanguage|fr|sun}} Dim. pass
rawMessage_toString {{#invoke:Diagnostics/MessageLibrary|plain_rawMessage|a$1c|b}} abc pass

Wikibase Library

name code actl rslt
getEntity {{#invoke:Diagnostics/WikibaseLibrary|label|q2}} Earth pass


Luaj

2.0.3 errors fixed in 3.0

name code actl rslt
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 pass

2.0.3 features removed from 3.0

name code actl rslt
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
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 pass

3.0 defects

name code actl rslt
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

TitleBlacklist

name code actl rslt
basic test; note that TitleBlacklists are not implemented in XOWA {{#invoke:Diagnostics/TitleBlacklist|test|Title_to_check_for_blacklist}} pass pass


Namespaces

XOWA

Getting started

Android

Help

Blog

Donate