モジュール:Check isxn/testcases

-- [[Module:Check isxn]]のユニットテスト例です。ノートをクリックして動作確認をしてください。
local p = require('Module:UnitTests')

function p:test_isbn_correct()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_isbn | 978-3-16-148410-0 | error = invalid}}', '')
end

function p:test_isbn_wrong()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_isbn | 978-0-12-345678-9 | error = invalid}}', 'invalid')
end

function p:test_isbn_duplicate()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_isbn | ISBN 978-3-16-148410-0 | error = invalid}}', 'invalid')
end

function p:test_ismn_correct()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_ismn | 979-0-9016791-7-7 | error = invalid}}', '')
end

function p:test_ismn_wrong()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_ismn | 979-0-1234567-8-9 | error = invalid}}', 'invalid')
end

function p:test_issn_correct()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_issn |1234-5679| error = invalid}}', '')
end

function p:test_issn_wrong()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_issn |1234-5678| error = invalid}}', 'invalid')
end

function p:test_issn_nohyphen()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_issn |12345679| error = invalid}}', '')
end

function p:test_issn_space()
    self:preprocess_equals('{{#invoke:Check isxn/sandbox | check_issn |1234 5679| error = invalid}}', 'invalid')
end

return p