Module:SandboxB/testcases3

-- trying to get unitTests working... -- first: use: https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Scribunto_libraries -- third: try: https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/engines/LuaCommon/lualib/mw.language.lua

local util = require( 'libraryUtil' ) local language = {} local php

-- second: copy original bananas/SandboxB to prove i have valid module... local p = {} function p.hello return "Hello, world!" end

function language.setupInterface -- Boilerplate language.setupInterface = nil php = mw_interface mw_interface = nil

-- Register this library in the "mw" global mw = mw or {} mw.language = language mw.getContentLanguage = language.getContentLanguage mw.getLanguage = mw.language.new

local lang = mw.getContentLanguage;

package.loaded['mw.language'] = language end

function language.getFallbacksFor( code ) return php.getFallbacksFor( code ) end

function language.new( code ) if code == nil then error( "too few arguments to mw.language.new", 2 ) end

local lang = { code = code } local checkSelf = util.makeCheckSelfFunction( 'mw.language', 'lang', lang, 'language object' )

function lang:getFallbackLanguages checkSelf( self, 'getFallbackLanguages' ) return language.getFallbacksFor( self.code ) end

return lang end

local contLangCode

function language.getContentLanguage if contLangCode == nil then contLangCode = php.getContLangCode end return language.new( contLangCode ) end

return language --return p