Module:File link/testcases
Appearance
![]() | This is the test cases page for the module Module:File link. Results of the test cases. |
-- Unit tests for [[Module:File link]]. Click on the talk page to run the tests.
local mFileLink = require('Module:File link')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
function suite:assertError(func, ...)
local success, result = pcall(func, ...)
self:assertFalse(success)
end
function suite:assertNotError(func, ...)
local success, result = pcall(func, ...)
self:assertTrue(success)
end
--------------------------------------------------------------------------------
-- Test fileLink.new
--------------------------------------------------------------------------------
function suite:testNewInputTypes()
self:assertNotError(mFileLink.new, nil)
self:assertNotError(mFileLink.new, 'foo')
self:assertError(mFileLink.new, 5)
self:assertError(mFileLink.new, true)
self:assertError(mFileLink.new, {})
self:assertError(mFileLink.new, function () return end)
end
return suite