Modul:Smartbox/parsers/testtilfeller


-- Unit tests for [[Module:Smartbox/parsers]]. Click talk page to run tests.
local Tests = require('Module:UnitTests')
local Parsers = require('Module:Smartbox/parsers')

function Tests:test_replace_terms()
	local units = { ['foo'] = 'bar', ['ping'] = 'pong' }
	self:equals( 'Replace terms ""', Parsers._replaceTerms( [[]], units ), '' )
	self:equals( 'Replace terms " "', Parsers._replaceTerms( [[ ]], units ), ' ' )
	self:equals( 'Replace terms "foo"', Parsers._replaceTerms( 'foo', units ), 'bar' )
	self:equals( 'Replace terms "foo ping"', Parsers._replaceTerms( 'foo ping', units ), 'bar pong' )
end

return Tests