return function()local p=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local A=p.Packages local r=require(A.Llama)local U=r.List local u=U.set it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local p={{0},{{};1.5}}for A=1,#p,1 do local r,U=pcall(function()u(unpack(p[A]))end);(expect(string.find(U,"\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(u(p,2,0))).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 A=0 setmetatable(p,{__newindex=function()A=A+1 end})u(p,3,"\098\097\114");(expect(A)).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\112\108\097\099\101 \116\104\101 \118\097\108\117\101 \097\116 \116\104\101 \103\105\118\101\110 \105\110\100\101\120",function()local p={1,2;3}local A={}local r=u(p,2,A);(expect(r[1])).to.equal(1);(expect(r[2])).to.equal(A);(expect(r[3])).to.equal(3);(expect(next(r[2]))).never.to.be.ok()end)it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \116\104\101 \103\105\118\101\110 \105\110\100\101\120 \105\115 \104\105\103\104\101\114 \116\104\097\110 \116\104\101 \108\105\115\116 \108\101\110\103\116\104 \043 \049",function()local p={1};(expect(function()u(p,#p+2,{})end)).to.throw()end)it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \116\104\101 \103\105\118\101\110 \105\110\100\101\120 \105\115 \108\111\119\101\114 \116\104\097\110 \049",function()local p={1};(expect(function()u(p,0,{})end)).to.throw()end)it("\115\104\111\117\108\100 \098\101 \097\098\108\101 \116\111 \114\101\112\108\097\099\101 \116\111 \097 \102\097\108\115\121 \118\097\108\117\101",function()local p={}local A={p,false,"\118\097\108\117\101";true}local r=false local U=u(A,3,r);(expect(U[1])).to.equal(p);(expect(U[2])).to.equal(false);(expect(U[3])).to.equal(r);(expect(U[4])).to.equal(true)end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

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

	local List = Llama.List
	local set = List.set

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

		for i = 1, #args do
			local _, err = pcall(function()
				set(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(set(a, 2, 0)).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,
		})

		set(a, 3, "bar")

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

	it("should replace the value at the given index", function()
		local a = { 1, 2, 3 }
		local value = {}
		local result = set(a, 2, value)

		expect(result[1]).to.equal(1)
		expect(result[2]).to.equal(value)
		expect(result[3]).to.equal(3)
		expect(next(result[2])).never.to.be.ok()
	end)

	it("should throw if the given index is higher than the list length + 1", function()
		local a = { 1 }

		expect(function()
			set(a, #a + 2, {})
		end).to.throw()
	end)

	it("should throw if the given index is lower than 1", function()
		local a = { 1 }

		expect(function()
			set(a, 0, {})
		end).to.throw()
	end)

	it("should be able to replace to a falsy value", function()
		local tableElement = {}
		local a = {tableElement, false, "value", true}
		local newValue = false

		local result = set(a, 3, newValue)

		expect(result[1]).to.equal(tableElement)
		expect(result[2]).to.equal(false)
		expect(result[3]).to.equal(newValue)
		expect(result[4]).to.equal(true)
	end)
end