package.path="\046\047\063\047\105\110\105\116\046\108\117\097\059"..package.path local k=require("\108\105\098")describe("\076\101\109\117\114",function()it("\115\104\111\117\108\100 \108\111\097\100 \109\111\100\117\108\101\115 \100\105\114\101\099\116\108\121",function()local K=k.Habitat.new()local V=K:loadFromFs("\115\112\101\099\047\114\101\113\117\105\114\101")local O=V:FindFirstChild("\097")assert.not_nil(O)local x=K:loadmodule(O)assert.equal(type(x),"\102\117\110\099\116\105\111\110")assert.equal(x(),"\102\111\111")assert.equal(V:FindFirstChild("\097"),O)assert.not_nil(V:FindFirstChild("\098"))end)it("\115\104\111\117\108\100 \108\111\097\100 \109\111\100\117\108\101\115 \102\114\111\109 \119\105\116\104\105\110 \102\111\108\100\101\114\115",function()local K=k.Habitat.new()local V=K:loadFromFs("\115\112\101\099\047\114\101\113\117\105\114\101")local O=K:loadmodule(V.foo)assert.equal(O(),"\113\117\120")end)it("\115\104\111\117\108\100 \110\111\116 \107\101\101\112 \097 \109\111\100\117\108\101 \099\097\099\104\101",function()local K=k.Habitat.new()local V=K:loadFromFs("\115\112\101\099\047\114\101\113\117\105\114\101")local O=K:loadmodule(V.cacheme)local x=K:loadmodule(V.cacheme)assert.not_equal(O,x)end)it("\115\104\111\117\108\100 \102\097\105\108 \116\111 \108\111\097\100 \110\111\110-\077\111\100\117\108\101\083\099\114\105\112\116\115",function()local K=k.Habitat.new()assert.has.errors(function()K:loadmodule(K.game)end)end)end)
package.path = "./?/init.lua;" .. package.path
local lemur = require("lib")

describe("Lemur", function()
	it("should load modules directly", function()
		local habitat = lemur.Habitat.new()

		local root = habitat:loadFromFs("spec/require")

		local module = root:FindFirstChild("a")

		assert.not_nil(module)

		local value = habitat:loadmodule(module)

		assert.equal(type(value), "function")

		assert.equal(value(), "foo")

		assert.equal(root:FindFirstChild("a"), module)
		assert.not_nil(root:FindFirstChild("b"))
	end)

	it("should load modules from within folders", function()
		local habitat = lemur.Habitat.new()

		local root = habitat:loadFromFs("spec/require")

		local value = habitat:loadmodule(root.foo)

		assert.equal(value(), "qux")
	end)

	it("should not keep a module cache", function()
		local habitat = lemur.Habitat.new()

		local root = habitat:loadFromFs("spec/require")

		local a = habitat:loadmodule(root.cacheme)
		local b = habitat:loadmodule(root.cacheme)

		assert.not_equal(a, b)
	end)

	it("should fail to load non-ModuleScripts", function()
		local habitat = lemur.Habitat.new()

		assert.has.errors(function()
			habitat:loadmodule(habitat.game)
		end)
	end)
end)