cucumber 0.3.11 → 0.3.90
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +101 -0
- data/Manifest.txt +14 -5
- data/config/hoe.rb +1 -2
- data/cucumber.yml +1 -0
- data/examples/i18n/ar/Rakefile +1 -1
- data/examples/i18n/ar/features/addition.feature +1 -0
- data/examples/i18n/bg/Rakefile +1 -1
- data/examples/i18n/bg/features/addition.feature +1 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/bg/features/division.feature +1 -0
- data/examples/i18n/cat/Rakefile +1 -1
- data/examples/i18n/cat/features/suma.feature +1 -0
- data/examples/i18n/da/Rakefile +1 -1
- data/examples/i18n/da/features/summering.feature +1 -0
- data/examples/i18n/de/Rakefile +1 -1
- data/examples/i18n/de/features/addition.feature +1 -0
- data/examples/i18n/de/features/division.feature +1 -0
- data/examples/i18n/en-lol/features/stuffing.feature +1 -1
- data/examples/i18n/en/Rakefile +1 -1
- data/examples/i18n/en/features/addition.feature +1 -0
- data/examples/i18n/en/features/division.feature +1 -0
- data/examples/i18n/es/Rakefile +1 -1
- data/examples/i18n/es/features/adicion.feature +1 -0
- data/examples/i18n/et/Rakefile +1 -1
- data/examples/i18n/et/features/jagamine.feature +1 -0
- data/examples/i18n/et/features/liitmine.feature +1 -0
- data/examples/i18n/fi/Rakefile +1 -1
- data/examples/i18n/fi/features/jakolasku.feature +1 -0
- data/examples/i18n/fr/Rakefile +1 -1
- data/examples/i18n/fr/features/addition.feature +2 -1
- data/examples/i18n/he/Rakefile +1 -1
- data/examples/i18n/he/features/addition.feature +1 -0
- data/examples/i18n/he/features/division.feature +1 -0
- data/examples/i18n/hu/Rakefile +1 -1
- data/examples/i18n/hu/features/addition.feature +1 -0
- data/examples/i18n/hu/features/division.feature +1 -0
- data/examples/i18n/id/Rakefile +1 -1
- data/examples/i18n/id/features/addition.feature +1 -0
- data/examples/i18n/id/features/division.feature +1 -0
- data/examples/i18n/it/Rakefile +1 -1
- data/examples/i18n/it/features/somma.feature +1 -0
- data/examples/i18n/ja/Rakefile +1 -1
- data/examples/i18n/ja/features/addition.feature +1 -0
- data/examples/i18n/ja/features/division.feature +1 -0
- data/examples/i18n/ko/Rakefile +1 -1
- data/examples/i18n/ko/features/addition.feature +6 -5
- data/examples/i18n/ko/features/division.feature +1 -0
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/Rakefile +1 -1
- data/examples/i18n/lt/features/addition.feature +1 -0
- data/examples/i18n/lt/features/division.feature +1 -0
- data/examples/i18n/lv/Rakefile +1 -1
- data/examples/i18n/lv/features/addition.feature +1 -0
- data/examples/i18n/lv/features/division.feature +1 -0
- data/examples/i18n/no/Rakefile +1 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pl/Rakefile +1 -1
- data/examples/i18n/pl/features/addition.feature +1 -0
- data/examples/i18n/pl/features/division.feature +1 -0
- data/examples/i18n/pt/Rakefile +1 -1
- data/examples/i18n/pt/features/adicao.feature +1 -0
- data/examples/i18n/ro/Rakefile +1 -1
- data/examples/i18n/ro/features/suma.feature +1 -0
- data/examples/i18n/ru/Rakefile +1 -1
- data/examples/i18n/ru/features/addition.feature +1 -0
- data/examples/i18n/ru/features/consecutive_calculations.feature +1 -0
- data/examples/i18n/ru/features/division.feature +1 -0
- data/examples/i18n/se/Rakefile +1 -1
- data/examples/i18n/se/features/summering.feature +1 -0
- data/examples/i18n/sk/Rakefile +1 -1
- data/examples/i18n/sk/features/addition.feature +1 -0
- data/examples/i18n/sk/features/division.feature +1 -0
- data/examples/i18n/zh-CN/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/addition.feature +1 -0
- data/examples/i18n/zh-TW/features/division.feature +1 -0
- data/examples/self_test/features/support/env.rb +2 -1
- data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
- data/examples/sinatra/features/support/env.rb +13 -5
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/features/after_block_exceptions.feature +4 -1
- data/features/after_step_block_exceptions.feature +4 -1
- data/features/background.feature +6 -0
- data/features/bug_371.feature +32 -0
- data/features/cucumber_cli.feature +11 -1
- data/features/cucumber_cli_diff_disabled.feature +9 -2
- data/features/drb_server_integration.feature +28 -5
- data/features/expand.feature +2 -1
- data/features/html_formatter/a.html +129 -1614
- data/features/junit_formatter.feature +4 -4
- data/features/language_from_header.feature +30 -0
- data/features/rake_task.feature +28 -0
- data/features/step_definitions/cucumber_steps.rb +2 -2
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +13 -5
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/features/work_in_progress.feature +3 -0
- data/gem_tasks/sass.rake +4 -0
- data/lib/cucumber.rb +0 -57
- data/lib/cucumber/ast/comment.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +4 -0
- data/lib/cucumber/ast/outline_table.rb +2 -1
- data/lib/cucumber/ast/py_string.rb +0 -1
- data/lib/cucumber/ast/scenario.rb +5 -3
- data/lib/cucumber/ast/scenario_outline.rb +6 -1
- data/lib/cucumber/ast/step.rb +8 -1
- data/lib/cucumber/ast/step_invocation.rb +6 -1
- data/lib/cucumber/ast/table.rb +287 -49
- data/lib/cucumber/ast/visitor.rb +2 -1
- data/lib/cucumber/cli/configuration.rb +45 -28
- data/lib/cucumber/cli/drb_client.rb +8 -9
- data/lib/cucumber/cli/language_help_formatter.rb +9 -7
- data/lib/cucumber/cli/main.rb +8 -9
- data/lib/cucumber/feature_file.rb +53 -0
- data/lib/cucumber/filter.rb +50 -0
- data/lib/cucumber/formatter/console.rb +12 -0
- data/lib/cucumber/formatter/cucumber.css +106 -48
- data/lib/cucumber/formatter/cucumber.sass +121 -31
- data/lib/cucumber/formatter/html.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +3 -6
- data/lib/cucumber/formatter/pretty.rb +22 -9
- data/lib/cucumber/formatter/profile.rb +1 -1
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +49 -0
- data/lib/cucumber/languages.yml +3 -3
- data/lib/cucumber/parser.rb +1 -33
- data/lib/cucumber/parser/feature.rb +39 -16
- data/lib/cucumber/parser/feature.tt +1 -3
- data/lib/cucumber/parser/i18n.tt +30 -23
- data/lib/cucumber/parser/i18n/language.rb +83 -0
- data/lib/cucumber/parser/treetop_ext.rb +12 -83
- data/lib/cucumber/platform.rb +6 -0
- data/lib/cucumber/rake/task.rb +6 -0
- data/lib/cucumber/step_definition.rb +6 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +3 -3
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/templates/cucumber.rake +4 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/cucumber/templates/spork_env.rb +1 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +17 -0
- data/rails_generators/feature/templates/feature.erb +1 -1
- data/rails_generators/feature/templates/steps.erb +2 -8
- data/spec/cucumber/ast/step_collection_spec.rb +5 -4
- data/spec/cucumber/ast/table_spec.rb +145 -0
- data/spec/cucumber/cli/configuration_spec.rb +55 -9
- data/spec/cucumber/cli/drb_client_spec.rb +5 -4
- data/spec/cucumber/cli/main_spec.rb +9 -12
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/parser/feature_parser_spec.rb +11 -9
- data/spec/cucumber/parser/table_parser_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- metadata +21 -20
- data/spec/cucumber/formatter/html/cucumber.css +0 -37
- data/spec/cucumber/formatter/html/cucumber.js +0 -13
- data/spec/cucumber/formatter/html/index.html +0 -45
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
@@ -1,39 +1,49 @@
|
|
1
1
|
# cucumber.css is generated from cucumber.sass
|
2
|
-
# Regenerate with
|
3
|
-
#
|
4
|
-
# sass -t expanded lib/cucumber/formatter/cucumber.sass > lib/cucumber/formatter/cucumber.css
|
5
|
-
#
|
6
|
-
.cucumber
|
7
|
-
:background black
|
8
|
-
:color white
|
9
|
-
:padding 1em
|
2
|
+
# Regenerate with rake sass
|
10
3
|
|
11
|
-
|
12
|
-
|
13
|
-
.undefined
|
14
|
-
:color yellow
|
15
|
-
.pending
|
16
|
-
:color yellow
|
17
|
-
.failed
|
18
|
-
:color red
|
19
|
-
.skipped
|
20
|
-
:color cyan
|
21
|
-
.outline
|
22
|
-
:color cyan
|
23
|
-
.param
|
24
|
-
:font-weight bold
|
4
|
+
!step_left = 5px solid
|
5
|
+
!step_bottom = 1px solid
|
25
6
|
|
26
|
-
|
27
|
-
|
28
|
-
|
7
|
+
!failed = #FFC0CB
|
8
|
+
!failed_dark = #FF0000
|
9
|
+
!failed_text = #8B0000
|
29
10
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
:font-weight normal
|
11
|
+
!passed = #98FB98
|
12
|
+
!passed_dark = #00FF00
|
13
|
+
!passed_text = #001111
|
34
14
|
|
35
|
-
|
36
|
-
|
15
|
+
!skipped = #E0FFFF
|
16
|
+
!skipped_dark = #00FFFF
|
17
|
+
!skipped_text = #001111
|
18
|
+
|
19
|
+
!pending = #FFFF00
|
20
|
+
!pending_dark = #FF8000
|
21
|
+
!pending_text = #2A1B0A
|
22
|
+
|
23
|
+
!undefined = #FFFF00
|
24
|
+
!undefined_dark = #FF8000
|
25
|
+
!undefined_text = #2A1B0A
|
26
|
+
|
27
|
+
.cucumber
|
28
|
+
:font-family "Lucida Grande", Helvetica, sans-serif
|
29
|
+
:font-size 0.7em
|
30
|
+
:background white
|
31
|
+
:padding 1em
|
32
|
+
|
33
|
+
h1, h2, h3, h4, ol, li, pre, p
|
34
|
+
:font-size 1em
|
35
|
+
:padding 0px
|
36
|
+
:margin 0px
|
37
|
+
|
38
|
+
div.feature
|
39
|
+
:border 1px solid
|
40
|
+
:padding 2px
|
41
|
+
:margin 4px
|
42
|
+
|
43
|
+
div.background, div.scenario, p
|
44
|
+
:padding 0em 0em 0em 1em
|
45
|
+
div.examples
|
46
|
+
:padding 0em 0em 0em 1em
|
37
47
|
|
38
48
|
.stats
|
39
49
|
:margin 2em
|
@@ -47,3 +57,83 @@
|
|
47
57
|
:margin-top 0
|
48
58
|
:margin-bottom 0
|
49
59
|
:margin-left 1em
|
60
|
+
|
61
|
+
a
|
62
|
+
:text-decoration none
|
63
|
+
:color inherit
|
64
|
+
|
65
|
+
&:hover
|
66
|
+
:text-decoration underline
|
67
|
+
&:visited
|
68
|
+
:font-weight normal
|
69
|
+
|
70
|
+
div.examples
|
71
|
+
:border 1px solid
|
72
|
+
:padding 2px
|
73
|
+
:margin 4px
|
74
|
+
|
75
|
+
table
|
76
|
+
:border-collapse collapse
|
77
|
+
|
78
|
+
td, th
|
79
|
+
:font-size 0.7em
|
80
|
+
:border 1px solid #AAAAAA
|
81
|
+
td.failed
|
82
|
+
:background #FFC0CB
|
83
|
+
:color #8B0000
|
84
|
+
td.passed
|
85
|
+
:background #98FB98
|
86
|
+
:color= !passed_text
|
87
|
+
td.skipped
|
88
|
+
:background= !skipped
|
89
|
+
:color= !skipped_text
|
90
|
+
td.pending
|
91
|
+
:background #FFFFE0
|
92
|
+
:color #111100
|
93
|
+
td.undefined
|
94
|
+
:background #FFFFE0
|
95
|
+
:color #111100
|
96
|
+
|
97
|
+
ol
|
98
|
+
:list-style none
|
99
|
+
|
100
|
+
li
|
101
|
+
:margin 0em 0em 0em 1em
|
102
|
+
:padding 0em 0em 0em 0.2em
|
103
|
+
span.param
|
104
|
+
:font-weight bold
|
105
|
+
li.failed
|
106
|
+
:border-left= !step_left !failed_dark
|
107
|
+
:border-bottom= !step_bottom !failed_dark
|
108
|
+
:background= !failed
|
109
|
+
:color= !failed_text
|
110
|
+
span.param
|
111
|
+
:background !failed_dark
|
112
|
+
li.passed
|
113
|
+
:border-left= !step_left !passed_dark
|
114
|
+
:border-bottom= !step_bottom !passed_dark
|
115
|
+
:background= !passed
|
116
|
+
:color= !passed_text
|
117
|
+
span.param
|
118
|
+
:background= !passed_dark
|
119
|
+
li.skipped
|
120
|
+
:border-left= !step_left !skipped_dark
|
121
|
+
:border-bottom= !step_bottom !skipped_dark
|
122
|
+
:background= !skipped
|
123
|
+
:color= !skipped_text
|
124
|
+
span.param
|
125
|
+
:background= !skipped_dark
|
126
|
+
li.pending
|
127
|
+
:border-left= !step_left !pending_dark
|
128
|
+
:border-bottom= !step_bottom !pending_dark
|
129
|
+
:background= !pending
|
130
|
+
:color= !pending_text
|
131
|
+
span.param
|
132
|
+
:background= !pending_dark
|
133
|
+
li.undefined
|
134
|
+
:border-left= !step_left !undefined_dark
|
135
|
+
:border-bottom= !step_bottom !undefined_dark
|
136
|
+
:background= !undefined
|
137
|
+
:color= !undefined_text
|
138
|
+
span.param
|
139
|
+
:background= !undefined_dark
|
@@ -20,7 +20,7 @@ module Cucumber
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_builder(io)
|
23
|
-
Builder::XmlMarkup.new(:target => io, :indent =>
|
23
|
+
Builder::XmlMarkup.new(:target => io, :indent => 0)
|
24
24
|
end
|
25
25
|
|
26
26
|
def visit_features(features)
|
@@ -54,7 +54,8 @@ module Cucumber
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def visit_comment_line(comment_line)
|
57
|
-
@builder.text!(comment_line
|
57
|
+
@builder.text!(comment_line)
|
58
|
+
@builder.br
|
58
59
|
end
|
59
60
|
|
60
61
|
def visit_feature(feature)
|
@@ -73,7 +74,7 @@ module Cucumber
|
|
73
74
|
@builder.h2 do |h2|
|
74
75
|
@builder.span(lines[0], :class => 'val')
|
75
76
|
end
|
76
|
-
@builder.p do
|
77
|
+
@builder.p(:class => 'narrative') do
|
77
78
|
lines[1..-1].each do |line|
|
78
79
|
@builder.text!(line.strip)
|
79
80
|
@builder.br
|
@@ -191,7 +192,7 @@ module Cucumber
|
|
191
192
|
|
192
193
|
def visit_py_string(string)
|
193
194
|
@builder.pre(:class => 'val') do |pre|
|
194
|
-
@builder.text!(string)
|
195
|
+
@builder.text!(' ' + string)
|
195
196
|
end
|
196
197
|
end
|
197
198
|
|
@@ -213,7 +214,7 @@ module Cucumber
|
|
213
214
|
@outline_row += 1 if @outline_row
|
214
215
|
end
|
215
216
|
|
216
|
-
def visit_table_cell_value(value,
|
217
|
+
def visit_table_cell_value(value, status)
|
217
218
|
cell_type = @outline_row == 0 ? :th : :td
|
218
219
|
attributes = {:id => "#{@row_id}_#{@col_index}", :class => 'val'}
|
219
220
|
attributes[:class] += " #{status}" if status
|
@@ -31,13 +31,14 @@ module Cucumber
|
|
31
31
|
@testsuite << @builder.target!
|
32
32
|
end
|
33
33
|
|
34
|
-
File.
|
34
|
+
basename = File.basename(feature.file)[0...-File.extname(feature.file).length]
|
35
|
+
feature_filename = File.join(@reportdir, "TEST-#{basename}.xml")
|
36
|
+
File.open(feature_filename, 'w') { |file| file.write(@testsuite.target!) }
|
35
37
|
end
|
36
38
|
|
37
39
|
def visit_feature_name(name)
|
38
40
|
lines = name.split(/\r?\n/)
|
39
41
|
@feature_name = lines[0].sub(/Feature\:/, '').strip
|
40
|
-
@feature_filename = convert_to_file_name(@feature_name)
|
41
42
|
end
|
42
43
|
|
43
44
|
def visit_scenario_name(keyword, name, file_colon_line, source_indent)
|
@@ -65,10 +66,6 @@ module Cucumber
|
|
65
66
|
|
66
67
|
private
|
67
68
|
|
68
|
-
def convert_to_file_name(feature_name)
|
69
|
-
File.join(@reportdir, "TEST-" + feature_name.gsub(/[^\w_\.]/, '_') + ".xml")
|
70
|
-
end
|
71
|
-
|
72
69
|
def format_exception(exception)
|
73
70
|
(["#{exception.message} (#{exception.class})"] + exception.backtrace).join("\n")
|
74
71
|
end
|
@@ -13,13 +13,13 @@ module Cucumber
|
|
13
13
|
include Console
|
14
14
|
attr_writer :indent
|
15
15
|
|
16
|
-
def initialize(step_mother, io, options
|
16
|
+
def initialize(step_mother, io, options)
|
17
17
|
super(step_mother)
|
18
18
|
@io = io
|
19
19
|
@options = options
|
20
|
-
@delim = delim
|
21
20
|
@exceptions = []
|
22
21
|
@indent = 0
|
22
|
+
@prefixes = options[:prefixes] || {}
|
23
23
|
end
|
24
24
|
|
25
25
|
def visit_features(features)
|
@@ -48,10 +48,8 @@ module Cucumber
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def visit_comment_line(comment_line)
|
51
|
-
|
52
|
-
|
53
|
-
@io.flush
|
54
|
-
end
|
51
|
+
@io.puts(comment_line.indent(@indent))
|
52
|
+
@io.flush
|
55
53
|
end
|
56
54
|
|
57
55
|
def visit_tags(tags)
|
@@ -147,6 +145,7 @@ module Cucumber
|
|
147
145
|
|
148
146
|
def visit_multiline_arg(multiline_arg)
|
149
147
|
return if @options[:no_multiline]
|
148
|
+
@table = multiline_arg
|
150
149
|
super
|
151
150
|
end
|
152
151
|
|
@@ -156,7 +155,8 @@ module Cucumber
|
|
156
155
|
end
|
157
156
|
|
158
157
|
def visit_table_row(table_row)
|
159
|
-
@
|
158
|
+
@col_index = 0
|
159
|
+
@io.print ' |'.indent(@indent-2)
|
160
160
|
super
|
161
161
|
@io.puts
|
162
162
|
if table_row.exception && !@exceptions.index(table_row.exception)
|
@@ -171,13 +171,26 @@ module Cucumber
|
|
171
171
|
@io.flush
|
172
172
|
end
|
173
173
|
|
174
|
-
def
|
174
|
+
def visit_table_cell(cell)
|
175
|
+
super
|
176
|
+
@col_index += 1
|
177
|
+
end
|
178
|
+
|
179
|
+
def visit_table_cell_value(value, status)
|
175
180
|
status ||= @status || :passed
|
176
|
-
|
181
|
+
width = @table.col_width(@col_index)
|
182
|
+
cell_text = value.to_s || ''
|
183
|
+
padded = cell_text + (' ' * (width - cell_text.jlength))
|
184
|
+
prefix = cell_prefix(status)
|
185
|
+
@io.print(' ' + format_string("#{prefix}#{padded}", status) + ::Term::ANSIColor.reset(" |"))
|
177
186
|
@io.flush
|
178
187
|
end
|
179
188
|
|
180
189
|
private
|
190
|
+
|
191
|
+
def cell_prefix(status)
|
192
|
+
@prefixes[status]
|
193
|
+
end
|
181
194
|
|
182
195
|
def print_summary(features)
|
183
196
|
print_stats(features)
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
21
21
|
duration = Time.now - @step_duration
|
22
22
|
super
|
23
23
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Formatter
|
3
|
+
class Steps < Ast::Visitor
|
4
|
+
|
5
|
+
def initialize(step_mother, io, options)
|
6
|
+
super(step_mother)
|
7
|
+
@io = io
|
8
|
+
@options = options
|
9
|
+
@step_definition_files = collect_steps(step_mother)
|
10
|
+
end
|
11
|
+
|
12
|
+
def visit_features(features)
|
13
|
+
print_summary
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def print_summary
|
19
|
+
count = 0
|
20
|
+
@step_definition_files.keys.sort.each do |step_definition_file|
|
21
|
+
@io.puts step_definition_file
|
22
|
+
|
23
|
+
sources = @step_definition_files[step_definition_file]
|
24
|
+
source_indent = source_indent(sources)
|
25
|
+
sources.sort.each do |file_colon_line, regexp|
|
26
|
+
@io.print "#{regexp}".indent(2)
|
27
|
+
@io.print " # #{file_colon_line}".indent(source_indent - regexp.size)
|
28
|
+
@io.puts
|
29
|
+
end
|
30
|
+
@io.puts
|
31
|
+
count += sources.size
|
32
|
+
end
|
33
|
+
@io.puts "#{count} step definition(s) in #{@step_definition_files.size} source file(s)."
|
34
|
+
end
|
35
|
+
|
36
|
+
def collect_steps(step_mother)
|
37
|
+
step_mother.step_definitions.inject({}) do |step_definitions, step_definition|
|
38
|
+
step_definitions[step_definition.file] ||= []
|
39
|
+
step_definitions[step_definition.file] << [ step_definition.file_colon_line, step_definition.regexp.inspect ]
|
40
|
+
step_definitions
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def source_indent(sources)
|
45
|
+
sources.map { |file_colon_line, regexp| regexp.size }.max + 1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/cucumber/languages.yml
CHANGED
@@ -91,14 +91,14 @@
|
|
91
91
|
native: Česky
|
92
92
|
encoding: UTF-8
|
93
93
|
feature: Požadavek
|
94
|
-
background:
|
94
|
+
background: Pozadí|Kontext
|
95
95
|
scenario: Scénář
|
96
|
-
scenario_outline: Náčrt Scénáře
|
96
|
+
scenario_outline: Náčrt Scénáře|Osnova scénáře
|
97
97
|
examples: Příklady
|
98
98
|
given: Pokud
|
99
99
|
when: Když
|
100
100
|
then: Pak
|
101
|
-
and: A
|
101
|
+
and: A|A také
|
102
102
|
but: Ale
|
103
103
|
space_after_keyword: true
|
104
104
|
"da":
|
data/lib/cucumber/parser.rb
CHANGED
@@ -3,36 +3,4 @@ require 'cucumber/platform'
|
|
3
3
|
require 'cucumber/ast'
|
4
4
|
require 'cucumber/parser/treetop_ext'
|
5
5
|
require 'cucumber/parser/table'
|
6
|
-
|
7
|
-
module Cucumber
|
8
|
-
# Classes in this module parse feature files and translate the parse tree
|
9
|
-
# (concrete syntax tree) into an abstract syntax tree (AST) using
|
10
|
-
# <a href="http://martinfowler.com/dslwip/EmbeddedTranslation.html">Embedded translation</a>.
|
11
|
-
#
|
12
|
-
# The AST is built by the various <tt>#build</tt> methods in the parse tree.
|
13
|
-
#
|
14
|
-
# The AST classes are defined in the Cucumber::Ast module.
|
15
|
-
module Parser
|
16
|
-
def self.load_parser(keywords)
|
17
|
-
Loader.new(keywords)
|
18
|
-
end
|
19
|
-
|
20
|
-
class Loader
|
21
|
-
def initialize(keywords)
|
22
|
-
@keywords = keywords
|
23
|
-
i18n_tt = File.expand_path(File.dirname(__FILE__) + '/parser/i18n.tt')
|
24
|
-
template = File.open(i18n_tt, Cucumber.file_mode('r')).read
|
25
|
-
erb = ERB.new(template)
|
26
|
-
grammar = erb.result(binding)
|
27
|
-
Treetop.load_from_string(grammar)
|
28
|
-
require 'cucumber/parser/feature'
|
29
|
-
end
|
30
|
-
|
31
|
-
def keywords(key, raw=false)
|
32
|
-
return @keywords[key] if raw
|
33
|
-
values = @keywords[key].split('|')
|
34
|
-
values.map{|value| "'#{value}'"}.join(" / ")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
6
|
+
require 'cucumber/parser/feature'
|
@@ -10,17 +10,13 @@ module Cucumber
|
|
10
10
|
include Treetop::Runtime
|
11
11
|
|
12
12
|
def root
|
13
|
-
@root || :
|
13
|
+
@root || :feature_sub
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
include Table
|
19
|
-
|
20
|
-
module Feature0
|
16
|
+
module FeatureSub0
|
21
17
|
end
|
22
18
|
|
23
|
-
module
|
19
|
+
module FeatureSub1
|
24
20
|
def white
|
25
21
|
elements[0]
|
26
22
|
end
|
@@ -55,10 +51,14 @@ module Cucumber
|
|
55
51
|
|
56
52
|
end
|
57
53
|
|
58
|
-
module
|
54
|
+
module FeatureSub2
|
59
55
|
def has_tags?(tag_names)
|
60
56
|
tags.has_tags?(tag_names)
|
61
57
|
end
|
58
|
+
|
59
|
+
def has_all_tags?(tag_names)
|
60
|
+
tags.has_all_tags?(tag_names)
|
61
|
+
end
|
62
62
|
|
63
63
|
def build(filter)
|
64
64
|
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
|
@@ -74,10 +74,10 @@ module Cucumber
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
77
|
+
def _nt_feature_sub
|
78
78
|
start_index = index
|
79
|
-
if node_cache[:
|
80
|
-
cached = node_cache[:
|
79
|
+
if node_cache[:feature_sub].has_key?(index)
|
80
|
+
cached = node_cache[:feature_sub][index]
|
81
81
|
@index = cached.interval.end if cached
|
82
82
|
return cached
|
83
83
|
end
|
@@ -139,7 +139,7 @@ module Cucumber
|
|
139
139
|
end
|
140
140
|
if s7.last
|
141
141
|
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
142
|
-
r7.extend(
|
142
|
+
r7.extend(FeatureSub0)
|
143
143
|
else
|
144
144
|
self.index = i7
|
145
145
|
r7 = nil
|
@@ -181,14 +181,14 @@ module Cucumber
|
|
181
181
|
end
|
182
182
|
if s0.last
|
183
183
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
184
|
-
r0.extend(
|
185
|
-
r0.extend(
|
184
|
+
r0.extend(FeatureSub1)
|
185
|
+
r0.extend(FeatureSub2)
|
186
186
|
else
|
187
187
|
self.index = i0
|
188
188
|
r0 = nil
|
189
189
|
end
|
190
190
|
|
191
|
-
node_cache[:
|
191
|
+
node_cache[:feature_sub][start_index] = r0
|
192
192
|
|
193
193
|
return r0
|
194
194
|
end
|
@@ -215,6 +215,10 @@ module Cucumber
|
|
215
215
|
ts.elements.detect{|e| e.tag.line == line}
|
216
216
|
end
|
217
217
|
|
218
|
+
def has_all_tags?(tags)
|
219
|
+
(tags & tag_names) == tags
|
220
|
+
end
|
221
|
+
|
218
222
|
def has_tags?(tags)
|
219
223
|
(tag_names & tags).any?
|
220
224
|
end
|
@@ -495,6 +499,11 @@ module Cucumber
|
|
495
499
|
feature_tags.has_tags?(tag_names)
|
496
500
|
end
|
497
501
|
|
502
|
+
def has_all_tags?(tag_names)
|
503
|
+
feature_tags = self.parent.tags
|
504
|
+
feature_tags.has_all_tags?(tag_names)
|
505
|
+
end
|
506
|
+
|
498
507
|
def build
|
499
508
|
Ast::Background.new(
|
500
509
|
comment.build,
|
@@ -692,6 +701,11 @@ module Cucumber
|
|
692
701
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
693
702
|
end
|
694
703
|
|
704
|
+
def has_all_tags?(tag_names)
|
705
|
+
feature_tags = self.parent.parent.tags
|
706
|
+
tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
|
707
|
+
end
|
708
|
+
|
695
709
|
def matches_name?(regexp_to_match)
|
696
710
|
name.build =~ regexp_to_match
|
697
711
|
end
|
@@ -830,6 +844,11 @@ module Cucumber
|
|
830
844
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
831
845
|
end
|
832
846
|
|
847
|
+
def has_all_tags?(tag_names)
|
848
|
+
feature_tags = self.parent.parent.tags
|
849
|
+
tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
|
850
|
+
end
|
851
|
+
|
833
852
|
def matches_name?(regexp_to_match)
|
834
853
|
outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
|
835
854
|
end
|
@@ -1166,6 +1185,10 @@ module Cucumber
|
|
1166
1185
|
true
|
1167
1186
|
end
|
1168
1187
|
|
1188
|
+
def has_all_tags?(tag_names)
|
1189
|
+
true
|
1190
|
+
end
|
1191
|
+
|
1169
1192
|
def outline_at_line?(line)
|
1170
1193
|
true
|
1171
1194
|
end
|
@@ -1346,7 +1369,7 @@ module Cucumber
|
|
1346
1369
|
|
1347
1370
|
module LinesToKeyword2
|
1348
1371
|
def build
|
1349
|
-
self.text_value.split("\n").map{|s| s.strip
|
1372
|
+
self.text_value.split("\n").map{|s| s.strip}.join("\n")
|
1350
1373
|
end
|
1351
1374
|
end
|
1352
1375
|
|