cuporter 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile
CHANGED
|
@@ -3,6 +3,16 @@ module StringExtensions
|
|
|
3
3
|
def to_class_name
|
|
4
4
|
gsub(/(^|_)([a-zA-Z])/) {$2.upcase}
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
APOSTROPHE = "\047"
|
|
8
|
+
APOS_ENTITY = "'"
|
|
9
|
+
def escape_apostrophe
|
|
10
|
+
gsub(APOSTROPHE, APOS_ENTITY)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def unescape_apostrophe
|
|
14
|
+
gsub(APOS_ENTITY, APOSTROPHE)
|
|
15
|
+
end
|
|
6
16
|
end
|
|
7
17
|
|
|
8
18
|
class String
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Cuporter
|
|
4
4
|
class FeatureParser
|
|
5
|
-
FEATURE_LINE = /^\s*(Feature:[^#]*)/
|
|
6
|
-
TAG_LINE = /^\s*(@\w.+)/
|
|
7
|
-
SCENARIO_LINE = /^\s*(Scenario:[^#]*)$/
|
|
8
|
-
SCENARIO_OUTLINE_LINE = /^\s*(Scenario Outline:[^#]*)$/
|
|
9
|
-
SCENARIO_SET_LINE = /^\s*(Scenarios:[^#]*)$/
|
|
10
|
-
EXAMPLE_SET_LINE = /^\s*(Examples:[^#]*)$/
|
|
11
|
-
EXAMPLE_LINE = /^\s*(\|.*\|)\s*$/
|
|
12
|
-
PY_STRING_LINE = /^\s*"""\s*$/
|
|
5
|
+
FEATURE_LINE = /^\s*(Feature:[^#]*)/u
|
|
6
|
+
TAG_LINE = /^\s*(@\w.+)/u
|
|
7
|
+
SCENARIO_LINE = /^\s*(Scenario:[^#]*)$/u
|
|
8
|
+
SCENARIO_OUTLINE_LINE = /^\s*(Scenario Outline:[^#]*)$/u
|
|
9
|
+
SCENARIO_SET_LINE = /^\s*(Scenarios:[^#]*)$/u
|
|
10
|
+
EXAMPLE_SET_LINE = /^\s*(Examples:[^#]*)$/u
|
|
11
|
+
EXAMPLE_LINE = /^\s*(\|.*\|)\s*$/u
|
|
12
|
+
PY_STRING_LINE = /^\s*"""\s*$/u
|
|
13
13
|
|
|
14
14
|
# adds a node to the doc for each cucumber '@' tag, populated with features and
|
|
15
15
|
# scenarios
|
|
@@ -49,30 +49,30 @@ module Cuporter
|
|
|
49
49
|
@open_comment_block = !@open_comment_block
|
|
50
50
|
when TAG_LINE
|
|
51
51
|
# may be more than one tag line
|
|
52
|
-
@current_tags |= $1.
|
|
52
|
+
@current_tags |= clean_cuke_line($1).split(/\s+/)
|
|
53
53
|
when FEATURE_LINE
|
|
54
|
-
@feature = new_feature_node($1
|
|
54
|
+
@feature = new_feature_node(clean_cuke_line($1), file_relative_path)
|
|
55
55
|
@current_tags = []
|
|
56
56
|
when SCENARIO_LINE
|
|
57
57
|
# How do we know when we have read all the lines from a "Scenario Outline:"?
|
|
58
58
|
# One way is when we encounter a "Scenario:"
|
|
59
59
|
close_scenario_outline
|
|
60
60
|
|
|
61
|
-
handle_scenario_line($1
|
|
61
|
+
handle_scenario_line(clean_cuke_line($1))
|
|
62
62
|
@current_tags = []
|
|
63
63
|
when SCENARIO_OUTLINE_LINE
|
|
64
64
|
# ... another is when we hit a subsequent "Scenario Outline:"
|
|
65
65
|
close_scenario_outline
|
|
66
66
|
|
|
67
|
-
@scenario_outline = new_scenario_outline_node($1
|
|
67
|
+
@scenario_outline = new_scenario_outline_node(clean_cuke_line($1))
|
|
68
68
|
@current_tags = []
|
|
69
69
|
when EXAMPLE_SET_LINE, SCENARIO_SET_LINE
|
|
70
70
|
handle_example_set_line if @example_set
|
|
71
71
|
|
|
72
|
-
@example_set = new_example_set_node($1
|
|
72
|
+
@example_set = new_example_set_node(clean_cuke_line($1))
|
|
73
73
|
@current_tags = []
|
|
74
74
|
when @example_set && EXAMPLE_LINE
|
|
75
|
-
new_example_line($1
|
|
75
|
+
new_example_line(clean_cuke_line($1))
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
@@ -81,5 +81,8 @@ module Cuporter
|
|
|
81
81
|
return @feature
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
def clean_cuke_line(sub_expression)
|
|
85
|
+
sub_expression.strip.escape_apostrophe
|
|
86
|
+
end
|
|
84
87
|
end
|
|
85
88
|
end
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
<xsl:template match="@cuke_name">
|
|
243
243
|
<xsl:element name="span">
|
|
244
244
|
<xsl:attribute name="class">cuke_name</xsl:attribute>
|
|
245
|
-
<xsl:value-of select="."/>
|
|
245
|
+
<xsl:value-of select="." disable-output-escaping="yes"/>
|
|
246
246
|
</xsl:element>
|
|
247
247
|
</xsl:template>
|
|
248
248
|
|
metadata
CHANGED