mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-12-18 02:41:09 +00:00
6bc11ff615
* Implemented the new parser interface based on a frame object, as described in the design document and wikitech-l. * Added parser tests for the new interface. * Removed {{script:}} parser function * Allow named parameters to {{#invoke:}} * Don't trim the return value * If a function invoked by #invoke returns multiple values, concatenate them into a single string. * If there is an error during parse, show the error message as an HTML comment as well as via JavaScript. This makes parser test construction easier, and probably makes debugging easier also. * Rename mw_internal to mw_php to clarify its role. It is now strictly a private Lua -> PHP interface function table. * Protect mw.setup() against multiple invocation. * Fixed a bug in Scribunto_LuaStandaloneInterpreter::receiveMessage(): large packets caused fread() to return with less than the requested amount of data, which previously caused an exception. It's necessary to check for EOF and to repeat the read to get all data. The receive function on the Lua side does not suffer from this problem. * In the standalone engine, fixed a bug in the interpretation of null return values from PHP callbacks. This should return no values to Lua. * Updated the Lua unit tests to account for the fact that functions are now forced to return strings. * Updated the getfenv and setfenv tests to account for the extra stack level introduced by mw.executeFunction(). Change-Id: If8fdecdfc91ebe7bd4b1dae8489ccbdeb6bbf5ce
20 lines
338 B
Lua
20 lines
338 B
Lua
local test = require( 'Module:CommonTests' )
|
|
local sbtest = {}
|
|
|
|
function sbtest.getTests()
|
|
return {
|
|
{ 'setfenv1', { error = '%sinvalid level%s' } },
|
|
{ 'getfenv1', { error = '%sinvalid level%s' } },
|
|
}
|
|
end
|
|
|
|
function sbtest.setfenv1()
|
|
setfenv( 3, {} )
|
|
end
|
|
|
|
function sbtest.getfenv1()
|
|
assert( getfenv( 3 ) == nil )
|
|
end
|
|
|
|
return sbtest
|