Jump to content

Module:auto cat/testcases

Wiktionary වෙතින්

3 of 0 tests failed. (refresh)

TextExpectedActual
test_family_cat:
Script error during testing: Module:string_utilities:785: bad argument #1 to '_find' (string expected, got table)
stack traceback:
	[C]: ?
	[C]: in function '_find'
	Module:string_utilities:785: in function 'iter'
	Module:string_utilities:714: in function 'split'
	Module:category_tree:44: in function 'split_lang_label'
	Module:auto_cat:62: in function 'handler'
	Module:auto_cat:189: in function 'test'
	Module:auto_cat/testcases:7: in function 'check'
	Module:auto_cat/testcases:27: in function <Module:auto_cat/testcases:26>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:893: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_langcatboiler:
Script error during testing: Module:string_utilities:785: bad argument #1 to '_find' (string expected, got table)
stack traceback:
	[C]: ?
	[C]: in function '_find'
	Module:string_utilities:785: in function 'iter'
	Module:string_utilities:714: in function 'split'
	Module:category_tree:44: in function 'split_lang_label'
	Module:auto_cat:62: in function 'handler'
	Module:auto_cat:189: in function 'test'
	Module:auto_cat/testcases:7: in function 'check'
	Module:auto_cat/testcases:20: in function <Module:auto_cat/testcases:17>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:893: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_language_splitter:
Script error during testing: Module:string_utilities:785: bad argument #1 to '_find' (string expected, got table)
stack traceback:
	[C]: ?
	[C]: in function '_find'
	Module:string_utilities:785: in function 'iter'
	Module:string_utilities:714: in function 'split'
	Module:category_tree:44: in function 'split_lang_label'
	Module:auto_cat:62: in function 'handler'
	Module:auto_cat:189: in function 'test'
	Module:auto_cat/testcases:7: in function 'check'
	Module:auto_cat/testcases:43: in function <Module:auto_cat/testcases:40>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:370: in function <Module:UnitTests:329>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:893: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require("Module:UnitTests")
local m_auto = require("Module:auto cat")

function tests:check(title, expected)
	self:equals(
		"[[:Category:" .. title .. "|" .. title .. "]]",
		m_auto.test(title),
		expected,
		{
			display = function(template)
				return "[[Template:" .. template .. "|" .. template .. "]]"
			end
		}
	)
end

function tests:test_langcatboiler()
	-- langcatboiler not enabled by default because it requires additional args
	-- self:check('German language', 'langcatboiler')
	self:check('Java programming language', 'topic cat')
	self:check('Nouns by language', 'poscatboiler')
	-- langcatboiler not enabled by default because it requires additional args
	-- self:check('American Sign Language', 'langcatboiler')
end

function tests:test_family_cat()
	self:check('Indo-European languages', 'family cat')
	self:check('Terms derived from Romance languages', 'poscatboiler')
	self:check('Computer languages', 'topic cat')
	self:check('fr:Computer languages', 'topic cat')
	self:check('Terms derived from creole or pidgin languages', 'poscatboiler')
	-- self:check('Egyptian hieroglyphic script languages', 'scriptcatboiler')
	self:check('Extinct languages', 'topic cat')
	self:check('Mixed languages', 'family cat')
	self:check('Terms derived from substrate languages', 'poscatboiler')
	self:check('English given names from Austronesian languages', 'name cat')
	self:check('English given names', 'poscatboiler')
end

function tests:test_language_splitter()
	-- Autocat must grab "Norwegian Nynorsk" and not "Norwegian" as the language
	-- name here.
	self:check('Norwegian Nynorsk words prefixed with des-', 'prefix cat')
end

return tests
"https://si.wiktionary.org/w/index.php?title=Module:auto_cat/testcases&oldid=40852" වෙතින් සම්ප්‍රවේශනය කෙරිණි