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.sort it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local p,A=pcall(function()u(0)end);(expect(string.find(A,"\101\120\112\101\099\116\101\100\044 \103\111\116"))).to.be.ok()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={};(expect(u(p))).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);(expect(A)).to.equal(0)end)it("\115\104\111\117\108\100 \099\111\110\116\097\105\110 \116\104\101 \115\097\109\101 \101\108\101\109\101\110\116\115 \102\114\111\109 \116\104\101 \103\105\118\101\110 \116\097\098\108\101",function()local p={"\102\111\111";"\098\097\114";"\098\097\122"}local A={foo=true;bar=true;baz=true}local r=u(p);(expect(#r)).to.equal(3)for p,r in ipairs(r)do(expect(A[r])).to.equal(true)end end)it("\115\104\111\117\108\100 \115\111\114\116 \119\105\116\104 \116\104\101 \100\101\102\097\117\108\116 \116\097\098\108\101\046\115\111\114\116 \119\104\101\110 \110\111 \099\097\108\108\098\097\099\107 \105\115 \103\105\118\101\110",function()local p={4,2,5,3;1}local A=u(p)table.sort(p);(expect(#A)).to.equal(#p)for r=1,#p,1 do(expect(A[r])).to.equal(p[r])end end)it("\115\104\111\117\108\100 \115\111\114\116 \119\105\116\104 \116\104\101 \103\105\118\101\110 \099\097\108\108\098\097\099\107",function()local p={1,2,5,3,4}local function A(p,A)return p>A end local r=u(p,A)table.sort(p,A);(expect(#r)).to.equal(#p)for A=1,#p,1 do(expect(r[A])).to.equal(p[A])end end)it("\115\104\111\117\108\100 \119\111\114\107 \119\105\116\104 \097\110 \101\109\112\116\121 \116\097\098\108\101",function()local p=u({});(expect(#p)).to.equal(0)end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

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

	local List = Llama.List
	local sort = List.sort

	it("should validate types", function()
		local _, err = pcall(function()
			sort(0)
		end)

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

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

		expect(sort(a)).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,
		})

		sort(a)

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

	it("should contain the same elements from the given table", function()
		local a = {
			"foo",
			"bar",
			"baz",
		}
		local elementSet = {
			foo = true,
			bar = true,
			baz = true,
		}
		local b = sort(a)

		expect(#b).to.equal(3)
		for _, value in ipairs(b) do
			expect(elementSet[value]).to.equal(true)
		end
	end)

	it("should sort with the default table.sort when no callback is given", function()
		local a = { 4, 2, 5, 3, 1 }
		local b = sort(a)

		table.sort(a)

		expect(#b).to.equal(#a)

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

	it("should sort with the given callback", function()
		local a = { 1, 2, 5, 3, 4 }

		local function comparator(first, second)
			return first > second
		end

		local b = sort(a, comparator)

		table.sort(a, comparator)

		expect(#b).to.equal(#a)

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

	it("should work with an empty table", function()
		local a = sort({})

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