local Z=require("\046\046\047\116\114\105\109\069\110\100")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("\100\111\101\115 \110\111\116 \114\101\109\111\118\101 \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 \111\110\108\121 \097\116 \101\110\100",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("\097\098\099\r\n\t\012\v"))).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 trimEnd = require('../trimEnd')

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

it('does not remove spaces at beginning', function()
    expect(trimEnd('  abc')).toEqual('  abc')
end)

it('removes spaces at end', function()
    expect(trimEnd('abc   ')).toEqual('abc')
end)

it('removes spaces at only at end', function()
    expect(trimEnd('  abc   ')).toEqual('  abc')
end)

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

it('removes all types of spaces', function()
    expect(trimEnd('abc\r\n\t\f\v')).toEqual('abc')
end)

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