Modulo:Criteri cancellazione immediata/test

require('strict')

local p = {}

function p.run_tests(frame)
	local wikitext = '== Namespace ==\n=== Default ===\n{{Criteri cancellazione immediata/Sandbox}}\n\n'
	local ids = {}

	for id in pairs(mw.site.namespaces) do
		if id >= 0 then
			table.insert(ids, id)
		end
	end

	table.sort(ids)

	for _, id in ipairs(ids) do
		local ns_name = mw.site.namespaces[id].name == '' and 'Principale' or mw.site.namespaces[id].name
		wikitext = string.format('%s=== %s ===\n{{Criteri cancellazione immediata/Sandbox|ns=%s}}\n\n',
			wikitext, ns_name, ns_name)
	end

	return frame:preprocess(wikitext)
end

return p