Source

love-mount / tests / dirname / main.lua

Full commit

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

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