Module:R from fictional object multi/testcases

-- Unit tests for [[Module:R from fictional object multi]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_01_multiple_categories()
	self:preprocess_equals_sandbox_many('{{#invoke:R from fictional object multi', 'main|category=character redirects to lists', {
		{"1=Arrow (TV series)", "[[Category:Arrow (TV series) character redirects to lists]]"},
		{"1=Arrow (TV series)|2=The Flash (2014 TV series)", "[[Category:Arrow (TV series) character redirects to lists]][[Category:The Flash (2014 TV series) character redirects to lists]]"},
		{"1=Arrow (TV series)|2=The Flash (2014 TV series)|3=Supergirl (TV series)", "[[Category:Arrow (TV series) character redirects to lists]][[Category:The Flash (2014 TV series) character redirects to lists]][[Category:Supergirl (TV series) character redirects to lists]]"},
		{"1=Arrow (TV series)|2=The Flash (2014 TV series)|3=Supergirl (TV series)|4=Batwoman (TV series)", "[[Category:Arrow (TV series) character redirects to lists]][[Category:The Flash (2014 TV series) character redirects to lists]][[Category:Supergirl (TV series) character redirects to lists]][[Category:Batwoman (TV series) character redirects to lists]]"},
		{"1=Arrow (TV series)|2=The Flash (2014 TV series)|3=Supergirl (TV series)|4=Batwoman (TV series)|5=Black Lightning (TV series)", "[[Category:Arrow (TV series) character redirects to lists]][[Category:The Flash (2014 TV series) character redirects to lists]][[Category:Supergirl (TV series) character redirects to lists]][[Category:Batwoman (TV series) character redirects to lists]][[Category:Black Lightning (TV series) character redirects to lists]]"},
	}, {nowiki=1})
end

function p:test_02_types()
	self:preprocess_equals_sandbox_many('{{#invoke:R from fictional object multi', 'main', {
		{"category=character redirects to lists|1=Arrow (TV series)", "[[Category:Arrow (TV series) character redirects to lists]]"},
		{"category=element redirects to lists|1=Arrow (TV series)", "[[Category:Arrow (TV series) element redirects to lists]]"},
		{"category=episode redirects to lists|1=Arrow (TV series)", "[[Category:Arrow (TV series) episode redirects to lists]]"},
		{"category=location redirects|1=Arrow (TV series)", "[[Category:Arrow (TV series) location redirects]]"},
	}, {nowiki=1})
end

function p:test_03_sort()
	self:preprocess_equals_sandbox_many('{{#invoke:R from fictional object multi', 'main', {
		{"category=character redirects to lists|1=Arrow (TV series)|sort=Oliver", "[[Category:Arrow (TV series) character redirects to lists|Oliver]]"},
		{"category=element redirects to lists|1=Arrow (TV series)|sort=Oliver", "[[Category:Arrow (TV series) element redirects to lists|Oliver]]"},
		{"category=episode redirects to lists|1=Arrow (TV series)|sort=Oliver", "[[Category:Arrow (TV series) episode redirects to lists|Oliver]]"},
		{"category=location redirects|1=Arrow (TV series)|sort=Oliver", "[[Category:Arrow (TV series) location redirects|Oliver]]"},
	}, {nowiki=1})
end

return p