return function()local p=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local s=p.Packages local P=require(s.Llama)local k=P.List local J=k.map it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local p={{0},{{};0};{0,function() end}}for s=1,#p,1 do local P,k=pcall(function()J(unpack(p[s]))end);(expect(string.find(k,"\101\120\112\101\099\116\101\100\044 \103\111\116"))).to.be.ok()end end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \110\101\119 \116\097\098\108\101",function()local p={1;2,3};(expect(J(p,function() end))).never.to.equal(p)end)it("\115\104\111\117\108\100 \110\111\116 \109\117\116\097\116\101 \112\097\115\115\101\100 \105\110 \116\097\098\108\101\115",function()local p={"\102\111\111";"\098\097\114"}local s=0 setmetatable(p,{__newindex=function()s=s+1 end})J(p,function() end);(expect(s)).to.equal(0)end)it("\115\104\111\117\108\100 \099\097\108\108 \116\104\101 \099\097\108\108\098\097\099\107 \102\111\114 \101\097\099\104 \101\108\101\109\101\110\116",function()local p={5,6;7}local s={}J(p,function(p,P)s[P]=p return p end)for p,P in pairs(p)do(expect(s[p])).to.equal(P)end for s,P in pairs(s)do(expect(P)).to.equal(p[s])end end)it("\115\104\111\117\108\100 \115\101\116 \116\104\101 \110\101\119 \118\097\108\117\101\115 \116\111 \116\104\101 \114\101\115\117\108\116 \111\102 \116\104\101 \103\105\118\101\110 \099\097\108\108\098\097\099\107",function()local p={5;6,7}local s=J(p,function(p)return p*2 end);(expect(#s)).to.equal(#p)for P=1,#p,1 do(expect(s[P])).to.equal(p[P]*2)end end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \118\097\108\117\101\115 \119\104\101\110 \110\105\108 \105\115 \114\101\116\117\114\110\101\100",function()local p={5;6;7}local s=J(p,function()return nil end);(expect(#s)).to.equal(0)end)it("\115\104\111\117\108\100 \119\111\114\107 \119\105\116\104 \097\110 \101\109\112\116\121 \108\105\115\116",function()local p={}local s=J(p,function() end);(expect(s)).to.be.a("\116\097\098\108\101");(expect(s)).never.to.equal(p)end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

	local Packages = ReplicatedStorage.Packages
	local Llama = require(Packages.Llama)

	local List = Llama.List
	local map = List.map

	it("should validate types", function()
		local args = {
			{ 0 },
			{ {}, 0 },
			{ 0, function() end },
		}

		for i = 1, #args do
			local _, err = pcall(function()
				map(unpack(args[i]))
			end)

			expect(string.find(err, "expected, got")).to.be.ok()
		end
	end)

	it("should return a new table", function()
		local a = { 1, 2, 3 }

		expect(map(a, function() end)).never.to.equal(a)
	end)

	it("should not mutate passed in tables", function()
		local a = { "foo", "bar" }
		local mutations = 0

		setmetatable(a, {
			__newindex = function()
				mutations = mutations + 1
			end,
		})

		map(a, function() end)

		expect(mutations).to.equal(0)
	end)

	it("should call the callback for each element", function()
		local a = { 5, 6, 7 }
		local copy = {}

		map(a, function(value, index)
			copy[index] = value
			return value
		end)

		for key, value in pairs(a) do
			expect(copy[key]).to.equal(value)
		end

		for key, value in pairs(copy) do
			expect(value).to.equal(a[key])
		end
	end)

	it("should set the new values to the result of the given callback", function()
		local a = { 5, 6, 7 }
		local b = map(a, function(value)
			return value * 2
		end)

		expect(#b).to.equal(#a)
		for i = 1, #a do
			expect(b[i]).to.equal(a[i] * 2)
		end
	end)

	it("should remove values when nil is returned", function()
		local a = { 5, 6, 7 }
		local b = map(a, function()
			return nil
		end)

		expect(#b).to.equal(0)
	end)

	it("should work with an empty list", function()
		local a = {}
		local b = map(a, function() end)

		expect(b).to.be.a("table")
		expect(b).never.to.equal(a)
	end)
end