local E=function(E,q)return{message="";pass=true}end local q="\067\097\110\110\111\116 \111\118\101\114\119\114\105\116\101 \109\097\116\099\104\101\114"return function()describe("\097\116\116\101\109\112\116 \116\111 \111\118\101\114\119\114\105\116\101 \100\101\102\097\117\108\116",function()beforeAll(function()local K,h=pcall(function()expect.extend({ok=E})end)assert(K==false,"\115\104\111\117\108\100 \104\097\118\101 \116\104\114\111\119\110")assert(h:match(q),string.format("\n\085\110\101\120\112\101\099\116\101\100 \101\114\114\111\114\058\n\037\115",h))end)end)describe("\097\116\116\101\109\112\116 \116\111 \111\118\101\114\119\114\105\116\101 \110\101\118\101\114",function()beforeAll(function()local K,h=pcall(function()expect.extend({never=E})end)assert(K==false,"\115\104\111\117\108\100 \104\097\118\101 \116\104\114\111\119\110")assert(h:match(q),string.format("\n\085\110\101\120\112\101\099\116\101\100 \101\114\114\111\114\058\n\037\115",h))end)end)describe("\097\116\116\101\109\112\116 \116\111 \111\118\101\114\119\114\105\116\101 \115\101\108\102",function()beforeAll(function()local K,h=pcall(function()expect.extend({a=E})end)assert(K==false,"\115\104\111\117\108\100 \104\097\118\101 \116\104\114\111\119\110")assert(h:match(q),string.format("\n\085\110\101\120\112\101\099\116\101\100 \101\114\114\111\114\058\n\037\115",h))end)end)end
-- luacheck: globals describe beforeAll expect it

local noOptMatcher = function(_received, _expected)
	return {
		message = "",
		pass = true,
	}
end

local ERROR_CANNOT_OVERWRITE = "Cannot overwrite matcher"

return function()
	describe("attempt to overwrite default", function()
		beforeAll(function()
			local success, message = pcall(function()
				expect.extend({
					-- This should throw since `ok` is a default matcher
					ok = noOptMatcher,
				})
			end)

			assert(success == false, "should have thrown")
			assert(message:match(ERROR_CANNOT_OVERWRITE), string.format("\nUnexpected error:\n%s", message))
		end)
	end)

	describe("attempt to overwrite never", function()
		beforeAll(function()
			local success, message = pcall(function()
				expect.extend({
					-- This should throw since `never` is a default matcher
					never = noOptMatcher,
				})
			end)

			assert(success == false, "should have thrown")
			assert(message:match(ERROR_CANNOT_OVERWRITE), string.format("\nUnexpected error:\n%s", message))
		end)
	end)

	describe("attempt to overwrite self", function()
		beforeAll(function()
			local success, message = pcall(function()
				expect.extend({
					-- This should throw since `a` is a default matcher
					a = noOptMatcher,
				})
			end)

			assert(success == false, "should have thrown")
			assert(message:match(ERROR_CANNOT_OVERWRITE), string.format("\nUnexpected error:\n%s", message))
		end)
	end)
end
