local a=require(script.Parent.Expectation)local c=a.checkMatcherNameCollisions local function G(a)local c={}for a,G in pairs(a)do c[a]=G end return c end local y={}y.__index=y function y.new(a)local c={_extensions=a and G(a._extensions)or{}}return setmetatable(c,y)end function y.startExpectationChain(c,...)return(a.new(...)):extend(c._extensions)end function y.extend(G,a)for a,y in pairs(a)do assert(G._extensions[a]==nil,string.format("\067\097\110\110\111\116 \114\101\097\115\115\105\103\110 \037\113 \105\110 \101\120\112\101\099\116\046\101\120\116\101\110\100",a))assert(c(a),string.format("\067\097\110\110\111\116 \111\118\101\114\119\114\105\116\101 \109\097\116\099\104\101\114 \037\113\059 \105\116 \097\108\114\101\097\100\121 \101\120\105\115\116\115",a))G._extensions[a]=y end end return y
local Expectation = require(script.Parent.Expectation)
local checkMatcherNameCollisions = Expectation.checkMatcherNameCollisions

local function copy(t)
	local result = {}

	for key, value in pairs(t) do
		result[key] = value
	end

	return result
end

local ExpectationContext = {}
ExpectationContext.__index = ExpectationContext

function ExpectationContext.new(parent)
	local self = {
		_extensions = parent and copy(parent._extensions) or {},
	}

	return setmetatable(self, ExpectationContext)
end

function ExpectationContext:startExpectationChain(...)
	return Expectation.new(...):extend(self._extensions)
end

function ExpectationContext:extend(config)
	for key, value in pairs(config) do
		assert(self._extensions[key] == nil, string.format("Cannot reassign %q in expect.extend", key))
		assert(checkMatcherNameCollisions(key), string.format("Cannot overwrite matcher %q; it already exists", key))

		self._extensions[key] = value
	end
end

return ExpectationContext
