lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.3.101 vs lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.3.101.2
- old
+ new
@@ -16,18 +16,10 @@
white
header:(!(scenario_outline / scenario / background) .)*
bg:background?
feature_elements
comment? {
- def has_tags?(tag_names)
- tags.has_tags?(tag_names)
- end
-
- def has_all_tags?(tag_names)
- tags.has_all_tags?(tag_names)
- end
-
def build(filter)
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
background = bg.respond_to?(:build) ? bg.build : nil
Ast::Feature.new(
background,
@@ -45,30 +37,22 @@
white ts:(tag (space/eol)+)* {
def at_line?(line)
ts.elements.detect{|e| e.tag.line == line}
end
- def has_tags?(tags)
- (tag_names & tags).any?
- end
-
- def has_all_tags?(tags)
- (tags & tag_names) == tags
- end
-
def build
Ast::Tags.new(ts.line, tag_names)
end
def tag_names
- @tag_names ||= ts.elements.map{|e| e.tag.tag_name.text_value}
+ @tag_names ||= ts.elements.map{|e| e.tag.text_value}
end
}
end
rule tag
- '@' tag_name:([^@\r\n\t ])+
+ '@' [^@\r\n\t ]+
end
rule comment
(comment_line white)* {
def build
@@ -90,20 +74,14 @@
def at_line?(line)
background_keyword.line == line ||
steps.at_line?(line)
end
- def has_tags?(tag_names)
- feature_tags = self.parent.tags
- feature_tags.has_tags?(tag_names)
+ def matches_tags?(tag_names)
+ Ast::Tags.matches?(self.parent.tags.tag_names, tag_names)
end
- def has_all_tags?(tag_names)
- feature_tags = self.parent.tags
- feature_tags.has_all_tags?(tag_names)
- end
-
def build
Ast::Background.new(
comment.build,
background_keyword.line,
background_keyword.text_value,
@@ -136,20 +114,16 @@
scenario_keyword.line == line ||
steps.at_line?(line) ||
tags.at_line?(line)
end
- def has_tags?(tag_names)
- feature_tags = self.parent.parent.tags
- tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
+ def matches_tags?(tag_names)
+ feature_tag_names = self.parent.parent.tags.tag_names
+ source_tag_names = (feature_tag_names + tags.tag_names).uniq
+ Ast::Tags.matches?(source_tag_names, tag_names)
end
- def has_all_tags?(tag_names)
- feature_tags = self.parent.parent.tags
- tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
- end
-
def matches_name?(regexp_to_match)
name.build =~ regexp_to_match
end
def build(background, filter)
@@ -177,20 +151,16 @@
def outline_at_line?(line)
scenario_outline_keyword.line == line ||
steps.at_line?(line)
end
- def has_tags?(tag_names)
- feature_tags = self.parent.parent.tags
- tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
+ def matches_tags?(tag_names)
+ feature_tag_names = self.parent.parent.tags.tag_names
+ source_tag_names = (feature_tag_names + tags.tag_names).uniq
+ Ast::Tags.matches?(source_tag_names, tag_names)
end
- def has_all_tags?(tag_names)
- feature_tags = self.parent.parent.tags
- tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
- end
-
def matches_name?(regexp_to_match)
outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
end
def outline_matches_name?(regexp_to_match)
@@ -266,14 +236,10 @@
def at_line?(line)
examples_keyword.line == line ||
table.at_line?(line)
end
- def has_tags?(tag_names)
- true
- end
-
- def has_all_tags?(tag_names)
+ def matches_tags?(tag_names)
true
end
def outline_at_line?(line)
true