return function()local i=require(script.Parent.assertDeepEqual)it("\115\104\111\117\108\100 \102\097\105\108 \119\105\116\104 \097 \109\101\115\115\097\103\101 \119\104\101\110 \097\114\103\115 \097\114\101 \110\111\116 \101\113\117\097\108",function()local W,K=pcall(i,1,2);(expect(W)).to.equal(false);(expect(K:find("\102\105\114\115\116 ~\061 \115\101\099\111\110\100"))).to.be.ok()W,K=pcall(i,{foo=1},{foo=2});(expect(W)).to.equal(false);(expect(K:find("\102\105\114\115\116\037\091\102\111\111\037\093 ~\061 \115\101\099\111\110\100\037\091\102\111\111\037\093"))).to.be.ok()end)it("\115\104\111\117\108\100 \099\111\109\112\097\114\101 \110\111\110-\116\097\098\108\101 \118\097\108\117\101\115 \117\115\105\110\103 \115\116\097\110\100\097\114\100 \'\061\061\' \101\113\117\097\108\105\116\121",function()i(1,1)i("\104\101\108\108\111","\104\101\108\108\111")i(nil,nil)local W=function() end local K=W i(W,K)local D={foo=W}local u={foo=K}i(D,u)end)it("\115\104\111\117\108\100 \102\097\105\108 \119\104\101\110 \116\121\112\101\115 \100\105\102\102\101\114",function()local W,K=pcall(i,1,"\049");(expect(W)).to.equal(false);(expect(K:find("\102\105\114\115\116 \105\115 \111\102 \116\121\112\101 \110\117\109\098\101\114\044 \098\117\116 \115\101\099\111\110\100 \105\115 \111\102 \116\121\112\101 \115\116\114\105\110\103"))).to.be.ok()end)it("\115\104\111\117\108\100 \099\111\109\112\097\114\101 \040\097\110\100 \114\101\112\111\114\116 \097\098\111\117\116\041 \110\101\115\116\101\100 \116\097\098\108\101\115",function()local W={foo="\098\097\114",nested={foo=1,bar=2}}local K={foo="\098\097\114";nested={foo=1,bar=2}}i(W,K)local D={foo="\098\097\114";nested={foo=1;bar=3}}local u,J=pcall(i,W,D);(expect(u)).to.equal(false);(expect(J:find("\102\105\114\115\116\037\091\110\101\115\116\101\100\037\093\037\091\098\097\114\037\093 ~\061 \115\101\099\111\110\100\037\091\110\101\115\116\101\100\037\093\037\091\098\097\114\037\093"))).to.be.ok()end)it("\115\104\111\117\108\100 \098\101 \099\111\109\109\117\116\097\116\105\118\101",function()local W={foo="\098\097\114";hello="\119\111\114\108\100"}local K={foo="\098\097\114";hello="\119\111\114\108\100"}i(W,K)i(K,W)local D={foo="\098\097\114"};(expect(function()i(W,D)end)).to.throw();(expect(function()i(D,W)end)).to.throw()end)end
return function()
	local assertDeepEqual = require(script.Parent.assertDeepEqual)

	it("should fail with a message when args are not equal", function()
		local success, message = pcall(assertDeepEqual, 1, 2)

		expect(success).to.equal(false)
		expect(message:find("first ~= second")).to.be.ok()

		success, message = pcall(assertDeepEqual, {
			foo = 1,
		}, {
			foo = 2,
		})

		expect(success).to.equal(false)
		expect(message:find("first%[foo%] ~= second%[foo%]")).to.be.ok()
	end)

	it("should compare non-table values using standard '==' equality", function()
		assertDeepEqual(1, 1)
		assertDeepEqual("hello", "hello")
		assertDeepEqual(nil, nil)

		local someFunction = function() end
		local theSameFunction = someFunction

		assertDeepEqual(someFunction, theSameFunction)

		local A = {
			foo = someFunction
		}
		local B = {
			foo = theSameFunction
		}

		assertDeepEqual(A, B)
	end)

	it("should fail when types differ", function()
		local success, message = pcall(assertDeepEqual, 1, "1")

		expect(success).to.equal(false)
		expect(message:find("first is of type number, but second is of type string")).to.be.ok()
	end)

	it("should compare (and report about) nested tables", function()
		local A = {
			foo = "bar",
			nested = {
				foo = 1,
				bar = 2,
			}
		}
		local B = {
			foo = "bar",
			nested = {
				foo = 1,
				bar = 2,
			}
		}

		assertDeepEqual(A, B)

		local C = {
			foo = "bar",
			nested = {
				foo = 1,
				bar = 3,
			}
		}

		local success, message = pcall(assertDeepEqual, A, C)

		expect(success).to.equal(false)
		expect(message:find("first%[nested%]%[bar%] ~= second%[nested%]%[bar%]")).to.be.ok()
	end)

	it("should be commutative", function()
		local equalArgsA = {
			foo = "bar",
			hello = "world",
		}
		local equalArgsB = {
			foo = "bar",
			hello = "world",
		}

		assertDeepEqual(equalArgsA, equalArgsB)
		assertDeepEqual(equalArgsB, equalArgsA)

		local nonEqualArgs = {
			foo = "bar",
		}

		expect(function() assertDeepEqual(equalArgsA, nonEqualArgs) end).to.throw()
		expect(function() assertDeepEqual(nonEqualArgs, equalArgsA) end).to.throw()
	end)
end