Source

love-mount / tests / basename / main.lua


TEST_NO=0
function test(path, basename)
	TEST_NO = TEST_NO + 1
	result = love.filesystem.basename(path)
	if result ~= basename then
		print("test "..TEST_NO.." failed!")
		print("  func:      love.filesystem.basename()")
		print("  argument  \""..path.."\")")
		print("  result:   \""..result.."\"")
		print("  expected: \""..basename.."\"")
	else
		print("test "..TEST_NO.." passed.")
	end
end

function love.load()
	print("Running tests...")
	test("", "")
	test("/", "")
	test("foo", "foo")
	test("foo/bar", "bar")
	love.event.quit()
end