# frozen_string_literal: truerequire'cucumber/core/test/result'require'cucumber/tag_expressions'moduleCucumbermoduleCoremoduleTestclassCaseattr_reader:id,:name,:test_steps,:location,:parent_locations,:tags,:language,:around_hooksdefinitialize(id,name,test_steps,location,parent_locations,tags,language,around_hooks=[])raiseArgumentError,"test_steps should be an Array but is a #{test_steps.class}"unlesstest_steps.is_a?(Array)@id=id@name=name@test_steps=test_steps@location=location@parent_locations=parent_locations@tags=tags@language=language@around_hooks=around_hooksenddefstep_counttest_steps.countenddefdescribe_to(visitor,*args)visitor.test_case(self,*args)do|child_visitor|compose_around_hooks(child_visitor,*args)dotest_steps.eachdo|test_step|test_step.describe_to(child_visitor,*args)endendendselfenddefwith_steps(test_steps)self.class.new(id,name,test_steps,location,parent_locations,tags,language,around_hooks)enddefwith_around_hooks(around_hooks)self.class.new(id,name,test_steps,location,parent_locations,tags,language,around_hooks)enddefmatch_tags?(*expressions)expressions.flatten.all?{|expression|match_single_tag_expression?(expression)}enddefmatch_name?(name_regexp)name=~name_regexpenddefmatch_locations?(queried_locations)queried_locations.any?do|queried_location|matching_locations.any?do|location|queried_location.match?locationendendenddefmatching_locations[parent_locations,location,tags.map(&:location),test_steps.map(&:matching_locations)].flattenenddefinspect"#<#{self.class}: #{location}>"enddefhashlocation.hashenddefeql?(other)other.hash==hashenddef==(other)eql?(other)endprivatedefcompose_around_hooks(visitor,*args,&block)around_hooks.reverse.reduce(block)do|continue,hook|->{hook.describe_to(visitor,*args,&continue)}end.callenddefmatch_single_tag_expression?(expression)Cucumber::TagExpressions::Parser.new.parse(expression).evaluate(tags.map(&:name))endendendendend