local E=function(E,q)return{message="";pass=true}end return function()beforeAll(function()expect.extend({scope_0=E})end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \098\101\102\111\114\101\065\108\108",function()assert((expect()).scope_0,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\048")end)describe("\115\099\111\112\101 \049",function()beforeAll(function()expect.extend({scope_1=E})end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \098\101\102\111\114\101\065\108\108",function()assert((expect()).scope_1,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\049")end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \114\111\111\116 \108\101\118\101\108 \098\101\102\111\114\101\065\108\108",function()assert((expect()).scope_0,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\048")end)it("\083\072\079\085\076\068 \078\079\084 \105\110\104\101\114\105\116 \115\099\111\112\101 \050",function()assert((expect()).scope_2==nil,"\115\104\111\117\108\100 \110\111\116 \104\097\118\101 \115\099\111\112\101\095\048")end)describe("\115\099\111\112\101 \050",function()beforeAll(function()expect.extend({scope_2=E})end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \098\101\102\111\114\101\065\108\108 \105\110 \115\099\111\112\101 \050",function()assert((expect()).scope_2,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\050")end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \098\101\102\111\114\101\065\108\108 \105\110 \115\099\111\112\101 \049",function()assert((expect()).scope_1,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\049")end)it("\083\072\079\085\076\068 \105\110\104\101\114\105\116 \102\114\111\109 \112\114\101\118\105\111\117\115 \098\101\102\111\114\101\065\108\108 \105\110 \115\099\111\112\101 \048",function()assert((expect()).scope_0,"\115\104\111\117\108\100 \104\097\118\101 \115\099\111\112\101\095\048")end)end)end)it("\083\072\079\085\076\068 \078\079\084 \105\110\104\101\114\105\116 \102\114\111\109 \115\099\111\112\101 \049",function()assert((expect()).scope_1==nil,"\115\104\111\117\108\100 \110\111\116 \104\097\118\101 \115\099\111\112\101\095\049")end)end
-- luacheck: globals describe beforeAll expect it

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

return function()
	beforeAll(function()
		expect.extend({
			scope_0 = noOptMatcher,
		})
	end)

	it("SHOULD inherit from previous beforeAll", function()
		assert(expect().scope_0, "should have scope_0")
	end)

	describe("scope 1", function()
		beforeAll(function()
			expect.extend({
				scope_1 = noOptMatcher,
			})
		end)

		it("SHOULD inherit from previous beforeAll", function()
			assert(expect().scope_1, "should have scope_1")
		end)

		it("SHOULD inherit from previous root level beforeAll", function()
			assert(expect().scope_0, "should have scope_0")
		end)

		it("SHOULD NOT inherit scope 2", function()
			assert(expect().scope_2 == nil, "should not have scope_0")
		end)

		describe("scope 2", function()
			beforeAll(function()
				expect.extend({
					scope_2 = noOptMatcher,
				})
			end)

			it("SHOULD inherit from previous beforeAll in scope 2", function()
				assert(expect().scope_2, "should have scope_2")
			end)

			it("SHOULD inherit from previous beforeAll in scope 1", function()
				assert(expect().scope_1, "should have scope_1")
			end)

			it("SHOULD inherit from previous beforeAll in scope 0", function()
				assert(expect().scope_0, "should have scope_0")
			end)
		end)
	end)

	it("SHOULD NOT inherit from scope 1", function()
		assert(expect().scope_1 == nil, "should not have scope_1")
	end)
end
