Error message for formatNum should not refer to formatDate

These new error messages were referring to formatDate instead of
formatNum.

Change-Id: Ic20a5a5515ee55d46087449627138cc779909ec3
Follow-up: Ib7706ad40f7ee2da6ab7c6b2dab6ae8d129dab52
Bug: T268758
This commit is contained in:
Derk-Jan Hartman 2020-11-26 14:12:15 +01:00
parent d3e3124652
commit d65c61e49b
2 changed files with 11 additions and 11 deletions

View file

@ -298,10 +298,10 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
$num = $args[0];
$this->checkType( 'formatNum', 1, $num, 'number' );
if ( is_infinite( $num ) ) {
throw new Scribunto_LuaError( "bad argument #1 to 'formatDate' (infinite)" );
throw new Scribunto_LuaError( "bad argument #1 to 'formatNum' (infinite)" );
}
if ( is_nan( $num ) ) {
throw new Scribunto_LuaError( "bad argument #1 to 'formatDate' (NaN)" );
throw new Scribunto_LuaError( "bad argument #1 to 'formatNum' (NaN)" );
}
$noCommafy = false;

View file

@ -252,9 +252,9 @@ return testframework.getTestProvider( {
{ name = 'lang:formatNum (NaN)', func = test_method,
args = { 'formatNum', 0/0 },
expect = {
"bad argument #1 to 'formatDate' (NaN)",
"bad argument #1 to 'formatDate' (NaN)",
"bad argument #1 to 'formatDate' (NaN)",
"bad argument #1 to 'formatNum' (NaN)",
"bad argument #1 to 'formatNum' (NaN)",
"bad argument #1 to 'formatNum' (NaN)",
"language code '[[bogus]]' is invalid",
}
},
@ -262,9 +262,9 @@ return testframework.getTestProvider( {
{ name = 'lang:formatNum (Inf)', func = test_method,
args = { 'formatNum', 1/0 },
expect = {
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"language code '[[bogus]]' is invalid",
}
},
@ -272,9 +272,9 @@ return testframework.getTestProvider( {
{ name = 'lang:formatNum (-Inf)', func = test_method,
args = { 'formatNum', -1/0 },
expect = {
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatDate' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"bad argument #1 to 'formatNum' (infinite)",
"language code '[[bogus]]' is invalid",
}
},