وحدة:StringUtils/شرح

من أرابيكا، الموسوعة الحرة
اذهب إلى التنقل اذهب إلى البحث

local p = require('وحدة:UnitTests')

function p:test_prependIfMissing() self:preprocess_equals("Q123", "Q123"); self:preprocess_equals("Q123", "Q123"); end

function p:test_appendIfMissing() self:preprocess_equals("aliale", "aliale"); self:preprocess_equals("niole", "niole"); end function p:test_capitalize() self:preprocess_equals("Aliale", "Aliale"); self:preprocess_equals("Alio", "Alio"); self:preprocess_equals("ALIO", "ALIO"); end function p:test_removeStart() self:preprocess_equals_many("", "", قالب:'noc) end function p:test_removeEnd() self:preprocess_equals_many("", "", قالب:'noc) end function p:test_startsWith() self:preprocess_equals_many("false", قالب:'noc) end function p:test_endsWith() self:preprocess_equals_many("false", قالب:'noc) end function p:test_substringBefore() self:preprocess_equals("[[ملف:Groundzero.jpg", "[[ملف:Groundzero.jpg") self:preprocess_equals("morom", "morom") end function p:test_substringAfter() self:preprocess_equals("oromete", "oromete") self:preprocess_equals("Groundzero.jpg", "Groundzero.jpg") end function p:test_defaultString() self:preprocess_equals("George", "George") self:preprocess_equals("Coșbuc", "Coșbuc") end

function p:test_appendToString() self:preprocess_equals("GeorgeCoșbuc", "GeorgeCoșbuc") self:preprocess_equals("", "") end

function p:test_prependToString() self:preprocess_equals("GeorgeCoșbuc", "GeorgeCoșbuc") self:preprocess_equals("", "") end

function p:test_encloseString() self:preprocess_equals("(Gigi", "(Gigi") self:preprocess_equals("", "") self:preprocess_equals("(Gigi)", "(Gigi)") self:preprocess_equals("Gigi)", "Gigi)") end

function p:test_stripNamespace() self:preprocess_equals("Groundzero.jpg", "Groundzero.jpg") self:preprocess_equals("Groundzero.jpg", "Groundzero.jpg") end return p