local Z=require("\046\046\047\116\114\105\109")local r=require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\106\101\115\116-\103\108\111\098\097\108\115")local s=r.expect local z=r.it z("\114\101\109\111\118\101\115 \115\112\097\099\101\115 \097\116 \098\101\103\105\110\110\105\110\103",function()(s(Z("  \097\098\099"))).toEqual("\097\098\099")end)z("\114\101\109\111\118\101\115 \115\112\097\099\101\115 \097\116 \101\110\100",function()(s(Z("\097\098\099   "))).toEqual("\097\098\099")end)z("\114\101\109\111\118\101\115 \115\112\097\099\101\115 \097\116 \098\111\116\104 \101\110\100\115",function()(s(Z("  \097\098\099   "))).toEqual("\097\098\099")end)z("\100\111\101\115 \110\111\116 \114\101\109\111\118\101 \115\112\097\099\101\115 \105\110 \116\104\101 \109\105\100\100\108\101",function()(s(Z("\097 \098 \099"))).toEqual("\097 \098 \099")end)z("\114\101\109\111\118\101\115 \097\108\108 \116\121\112\101\115 \111\102 \115\112\097\099\101\115",function()(s(Z("\r\n\t\012\v\097\098\099"))).toEqual("\097\098\099")end)z("\114\101\116\117\114\110\115 \097\110 \101\109\112\116\121 \115\116\114\105\110\103 \105\102 \116\104\101\114\101 \097\114\101 \111\110\108\121 \115\112\097\099\101\115",function()(s(Z("    "))).toEqual("")end)
local trim = require('../trim')

local JestGlobals = require('@pkg/@jsdotlua/jest-globals')
local jestExpect = JestGlobals.expect
local it = JestGlobals.it

it('removes spaces at beginning', function()
    jestExpect(trim('  abc')).toEqual('abc')
end)

it('removes spaces at end', function()
    jestExpect(trim('abc   ')).toEqual('abc')
end)

it('removes spaces at both ends', function()
    jestExpect(trim('  abc   ')).toEqual('abc')
end)

it('does not remove spaces in the middle', function()
    jestExpect(trim('a b c')).toEqual('a b c')
end)

it('removes all types of spaces', function()
    jestExpect(trim('\r\n\t\f\vabc')).toEqual('abc')
end)

it('returns an empty string if there are only spaces', function()
    jestExpect(trim('    ')).toEqual('')
end)
