function TestSession.setStatusFromChildren(u)assert(#u.nodeStack>0,"\065\116\116\101\109\112\116\105\110\103 \116\111 \115\101\116 \115\116\097\116\117\115 \102\114\111\109 \099\104\105\108\100\114\101\110 \111\110 \101\109\112\116\121 \115\116\097\099\107")local q=u.nodeStack[#u.nodeStack]local h=TestEnum.TestStatus.Success local S=true for u,q in ipairs(q.children)do if q.status~=TestEnum.TestStatus.Skipped then S=false if q.status==TestEnum.TestStatus.Failure then h=TestEnum.TestStatus.Failure end end end if S then h=TestEnum.TestStatus.Skipped end q.status=h end return TestSession
--[[
	Set the current node's status based on that of its children. If all children
	are skipped, mark it as skipped. If any are fails, mark it as failed.
	Otherwise, mark it as success.
]]
function TestSession:setStatusFromChildren()
	assert(#self.nodeStack > 0, "Attempting to set status from children on empty stack")

	local last = self.nodeStack[#self.nodeStack]
	local status = TestEnum.TestStatus.Success
	local skipped = true

	-- If all children were skipped, then we were skipped
	-- If any child failed, then we failed!
	for _, child in ipairs(last.children) do
		if child.status ~= TestEnum.TestStatus.Skipped then
			skipped = false

			if child.status == TestEnum.TestStatus.Failure then
				status = TestEnum.TestStatus.Failure
			end
		end
	end

	if skipped then
		status = TestEnum.TestStatus.Skipped
	end

	last.status = status
end

return TestSession
