kosmas58-cucumber 0.2.2.1 → 0.2.3.3
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/History.txt +57 -5
- data/Manifest.txt +21 -4
- data/bin/cucumber +1 -1
- data/config/hoe.rb +2 -2
- data/examples/i18n/Rakefile +6 -8
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ar/lib/calculator.rb +1 -0
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -1
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ko/features/addition.feature +1 -1
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/no/features/support/env.rb +1 -1
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ru/features/support/env.rb +1 -1
- data/examples/i18n/ru/features/support/world.rb +4 -3
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/sk/Rakefile +6 -0
- data/examples/i18n/sk/features/addition.feature +16 -0
- data/examples/i18n/sk/features/division.feature +9 -0
- data/examples/i18n/sk/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/sk/lib/calculator.rb +14 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/self_test/features/background/background_with_name.feature +7 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +8 -2
- data/examples/self_test/features/undefined_multiline_args.feature +12 -0
- data/examples/sinatra/features/support/env.rb +2 -6
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +1 -4
- data/examples/tickets/Rakefile +1 -1
- data/examples/tickets/features/246.feature +4 -0
- data/examples/tickets/features/270/back.feature +14 -0
- data/examples/tickets/features/270/back.steps.rb +14 -0
- data/examples/tickets/features/step_definitons/246_steps.rb +3 -0
- data/features/background.feature +21 -4
- data/features/cucumber_cli.feature +18 -5
- data/features/cucumber_cli_outlines.feature +5 -2
- data/features/snippet.feature +23 -0
- data/features/step_definitions/cucumber_steps.rb +6 -2
- data/features/usage.feature +5 -0
- data/gem_tasks/rspec.rake +3 -2
- data/lib/cucumber/ast/background.rb +3 -3
- data/lib/cucumber/ast/examples.rb +0 -12
- data/lib/cucumber/ast/feature.rb +2 -12
- data/lib/cucumber/ast/feature_element.rb +0 -8
- data/lib/cucumber/ast/features.rb +1 -1
- data/lib/cucumber/ast/outline_table.rb +14 -22
- data/lib/cucumber/ast/py_string.rb +6 -11
- data/lib/cucumber/ast/scenario.rb +1 -8
- data/lib/cucumber/ast/scenario_outline.rb +1 -11
- data/lib/cucumber/ast/step.rb +3 -9
- data/lib/cucumber/ast/step_collection.rb +0 -4
- data/lib/cucumber/ast/step_invocation.rb +5 -6
- data/lib/cucumber/ast/table.rb +26 -22
- data/lib/cucumber/ast/tags.rb +0 -8
- data/lib/cucumber/ast/visitor.rb +12 -25
- data/lib/cucumber/cli/configuration.rb +2 -2
- data/lib/cucumber/cli/main.rb +5 -2
- data/lib/cucumber/core_ext/instance_exec.rb +17 -4
- data/lib/cucumber/formatter/ansicolor.rb +10 -2
- data/lib/cucumber/formatter/console.rb +2 -1
- data/lib/cucumber/formatter/html.rb +21 -7
- data/lib/cucumber/formatter/pretty.rb +27 -20
- data/lib/cucumber/formatter/usage.rb +16 -0
- data/lib/cucumber/languages.yml +68 -7
- data/lib/cucumber/parser/feature.rb +238 -135
- data/lib/cucumber/parser/feature.tt +117 -22
- data/lib/cucumber/parser/i18n.tt +4 -0
- data/lib/cucumber/parser/table.rb +37 -25
- data/lib/cucumber/parser/table.tt +15 -3
- data/lib/cucumber/parser/treetop_ext.rb +48 -9
- data/lib/cucumber/parser.rb +2 -7
- data/lib/cucumber/step_definition.rb +13 -14
- data/lib/cucumber/step_mother.rb +93 -11
- data/lib/cucumber/version.rb +2 -2
- data/rails_generators/cucumber/templates/env.rb +1 -1
- data/rails_generators/cucumber/templates/paths.rb +15 -5
- data/rails_generators/cucumber/templates/webrat_steps.rb +8 -0
- data/spec/cucumber/ast/background_spec.rb +1 -0
- data/spec/cucumber/ast/feature_factory.rb +1 -1
- data/spec/cucumber/ast/feature_spec.rb +2 -2
- data/spec/cucumber/ast/scenario_spec.rb +0 -27
- data/spec/cucumber/ast/table_spec.rb +23 -2
- data/spec/cucumber/core_ext/proc_spec.rb +25 -8
- data/spec/cucumber/parser/feature_parser_spec.rb +43 -41
- data/spec/cucumber/step_definition_spec.rb +8 -0
- data/spec/cucumber/step_mother_spec.rb +48 -0
- data/spec/spec_helper.rb +2 -11
- metadata +17 -6
- data/examples/tickets/cucumber.yml +0 -3
- data/lib/cucumber/parser/basic.rb +0 -0
- data/spec/cucumber/ast/tags_spec.rb +0 -19
data/lib/cucumber/ast/table.rb
CHANGED
@@ -12,6 +12,10 @@ module Cucumber
|
|
12
12
|
|
13
13
|
attr_accessor :file
|
14
14
|
|
15
|
+
def self.default_arg_name
|
16
|
+
"table"
|
17
|
+
end
|
18
|
+
|
15
19
|
def initialize(raw, conversions = NULL_CONVERSIONS.dup)
|
16
20
|
# Verify that it's square
|
17
21
|
raw.transpose
|
@@ -60,6 +64,23 @@ module Cucumber
|
|
60
64
|
row.to_hash
|
61
65
|
end
|
62
66
|
end
|
67
|
+
|
68
|
+
# Converts this table into a Hash where the first column is
|
69
|
+
# used as keys and the second column is used as values
|
70
|
+
#
|
71
|
+
# | a | 2 |
|
72
|
+
# | b | 3 |
|
73
|
+
#
|
74
|
+
# Gets converted into the following:
|
75
|
+
#
|
76
|
+
# {'a' => '2', 'b' => '3'}
|
77
|
+
#
|
78
|
+
# The table must be exactly two columns wide
|
79
|
+
#
|
80
|
+
def rows_hash
|
81
|
+
verify_table_width(2)
|
82
|
+
@rows_hash = self.transpose.hashes[0]
|
83
|
+
end
|
63
84
|
|
64
85
|
# Gets the raw data of this table. For example, a Table built from
|
65
86
|
# the following plain text:
|
@@ -84,10 +105,6 @@ module Cucumber
|
|
84
105
|
cells_rows.each(&proc)
|
85
106
|
end
|
86
107
|
|
87
|
-
def matches_lines?(lines)
|
88
|
-
cells_rows.detect{|row| row.matches_lines?(lines)}
|
89
|
-
end
|
90
|
-
|
91
108
|
def accept(visitor)
|
92
109
|
cells_rows.each do |row|
|
93
110
|
visitor.visit_table_row(row)
|
@@ -95,12 +112,6 @@ module Cucumber
|
|
95
112
|
nil
|
96
113
|
end
|
97
114
|
|
98
|
-
def status=(status)
|
99
|
-
cells_rows.each do |row|
|
100
|
-
row.status = status
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
115
|
# For testing only
|
105
116
|
def to_sexp #:nodoc:
|
106
117
|
[:table, *cells_rows.map{|row| row.to_sexp}]
|
@@ -160,6 +171,10 @@ module Cucumber
|
|
160
171
|
def verify_column(column_name)
|
161
172
|
raise %{The column named "#{column_name}" does not exist} unless @raw[0].include?(column_name)
|
162
173
|
end
|
174
|
+
|
175
|
+
def verify_table_width(width)
|
176
|
+
raise %{The table must have exactly #{width} columns} unless @raw[0].size == width
|
177
|
+
end
|
163
178
|
|
164
179
|
def arguments_replaced(arguments) #:nodoc:
|
165
180
|
raw_with_replaced_args = raw.map do |row|
|
@@ -232,10 +247,6 @@ module Cucumber
|
|
232
247
|
@table, @cells = table, cells
|
233
248
|
end
|
234
249
|
|
235
|
-
def matches_lines?(lines)
|
236
|
-
lines.index(line)
|
237
|
-
end
|
238
|
-
|
239
250
|
def accept(visitor)
|
240
251
|
each do |cell|
|
241
252
|
visitor.visit_table_cell(cell)
|
@@ -245,7 +256,7 @@ module Cucumber
|
|
245
256
|
|
246
257
|
# For testing only
|
247
258
|
def to_sexp #:nodoc:
|
248
|
-
[:row, *@cells.map{|cell| cell.to_sexp}]
|
259
|
+
[:row, line, *@cells.map{|cell| cell.to_sexp}]
|
249
260
|
end
|
250
261
|
|
251
262
|
def to_hash #:nodoc:
|
@@ -268,12 +279,6 @@ module Cucumber
|
|
268
279
|
"row_#{line}"
|
269
280
|
end
|
270
281
|
|
271
|
-
def status=(status)
|
272
|
-
each do |cell|
|
273
|
-
cell.status = status
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
282
|
private
|
278
283
|
|
279
284
|
def index
|
@@ -295,7 +300,6 @@ module Cucumber
|
|
295
300
|
|
296
301
|
def initialize(value, table, row, col, line)
|
297
302
|
@value, @table, @row, @col, @line = value, table, row, col, line
|
298
|
-
@status = :passed
|
299
303
|
end
|
300
304
|
|
301
305
|
def accept(visitor)
|
data/lib/cucumber/ast/tags.rb
CHANGED
@@ -11,14 +11,6 @@ module Cucumber
|
|
11
11
|
@line, @tag_names = line, tag_names
|
12
12
|
end
|
13
13
|
|
14
|
-
def has_tags?(tags)
|
15
|
-
(@tag_names & tags).any?
|
16
|
-
end
|
17
|
-
|
18
|
-
def matches_lines?(lines)
|
19
|
-
lines.index(@line)
|
20
|
-
end
|
21
|
-
|
22
14
|
def accept(visitor)
|
23
15
|
@tag_names.each do |tag_name|
|
24
16
|
visitor.visit_tag_name(tag_name)
|
data/lib/cucumber/ast/visitor.rb
CHANGED
@@ -8,25 +8,6 @@ module Cucumber
|
|
8
8
|
def initialize(step_mother)
|
9
9
|
@options = {}
|
10
10
|
@step_mother = step_mother
|
11
|
-
@current_feature_lines = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def current_feature_lines=(lines)
|
15
|
-
@current_feature_lines = lines
|
16
|
-
end
|
17
|
-
|
18
|
-
def matches_lines?(node)
|
19
|
-
@current_feature_lines.empty? || node.matches_lines?(@current_feature_lines)
|
20
|
-
end
|
21
|
-
|
22
|
-
def included_by_tags?(node)
|
23
|
-
tags = options[:include_tags] || []
|
24
|
-
tags.empty? || node.has_tags?(tags)
|
25
|
-
end
|
26
|
-
|
27
|
-
def excluded_by_tags?(node)
|
28
|
-
tags = options[:exclude_tags] || []
|
29
|
-
tags.any? && node.has_tags?(tags)
|
30
11
|
end
|
31
12
|
|
32
13
|
def matches_scenario_names?(node)
|
@@ -93,14 +74,23 @@ module Cucumber
|
|
93
74
|
step.accept(self)
|
94
75
|
end
|
95
76
|
|
96
|
-
def
|
77
|
+
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
78
|
+
visit_step_name(keyword, step_match, status, source_indent, background)
|
79
|
+
visit_multiline_arg(multiline_arg) if multiline_arg
|
80
|
+
visit_exception(exception, status) if exception
|
81
|
+
end
|
82
|
+
|
83
|
+
def visit_step_name(keyword, step_match, status, source_indent, background) #:nodoc:
|
97
84
|
end
|
98
85
|
|
99
|
-
def visit_multiline_arg(multiline_arg)
|
86
|
+
def visit_multiline_arg(multiline_arg) #:nodoc:
|
100
87
|
multiline_arg.accept(self)
|
101
88
|
end
|
102
89
|
|
103
|
-
def
|
90
|
+
def visit_exception(exception, status) #:nodoc:
|
91
|
+
end
|
92
|
+
|
93
|
+
def visit_py_string(string)
|
104
94
|
end
|
105
95
|
|
106
96
|
def visit_table_row(table_row)
|
@@ -114,9 +104,6 @@ module Cucumber
|
|
114
104
|
def visit_table_cell_value(value, width, status)
|
115
105
|
end
|
116
106
|
|
117
|
-
def visit_exception(exception, status)
|
118
|
-
end
|
119
|
-
|
120
107
|
def announce(announcement)
|
121
108
|
end
|
122
109
|
|
@@ -257,11 +257,11 @@ module Cucumber
|
|
257
257
|
|
258
258
|
potential_feature_files
|
259
259
|
end
|
260
|
-
|
260
|
+
|
261
261
|
protected
|
262
262
|
|
263
263
|
def feature_dirs
|
264
|
-
|
264
|
+
@paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq
|
265
265
|
end
|
266
266
|
|
267
267
|
def constantize(camel_cased_word)
|
data/lib/cucumber/cli/main.rb
CHANGED
@@ -52,8 +52,11 @@ module Cucumber
|
|
52
52
|
|
53
53
|
verbose_log("Features:")
|
54
54
|
configuration.feature_files.each do |f|
|
55
|
-
|
56
|
-
|
55
|
+
feature = parser.parse_file(f, configuration.options)
|
56
|
+
if feature
|
57
|
+
features.add_feature(feature)
|
58
|
+
verbose_log(" * #{f}")
|
59
|
+
end
|
57
60
|
end
|
58
61
|
verbose_log("\n"*2)
|
59
62
|
features
|
@@ -7,12 +7,14 @@ end
|
|
7
7
|
|
8
8
|
class Object
|
9
9
|
def cucumber_instance_exec(check_arity, pseudo_method, *args, &block)
|
10
|
-
arity = block.arity
|
11
|
-
arity = 0 if arity == -1
|
12
10
|
cucumber_run_with_backtrace_filtering(pseudo_method) do
|
13
|
-
if check_arity && args
|
11
|
+
if check_arity && !cucumber_compatible_arity?(args, block)
|
14
12
|
instance_exec do
|
15
|
-
|
13
|
+
s1 = cucumber_arity(block) == 1 ? "" : "s"
|
14
|
+
s2 = args.length == 1 ? "" : "s"
|
15
|
+
raise Cucumber::ArityMismatchError.new(
|
16
|
+
"Your block takes #{cucumber_arity(block)} argument#{s1}, but the Regexp matched #{args.length} argument#{s2}."
|
17
|
+
)
|
16
18
|
end
|
17
19
|
else
|
18
20
|
instance_exec(*args, &block)
|
@@ -20,6 +22,17 @@ class Object
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
25
|
+
def cucumber_arity(block)
|
26
|
+
a = block.arity
|
27
|
+
Cucumber::RUBY_1_9 ? a : (a == -1 ? 0 : a)
|
28
|
+
end
|
29
|
+
|
30
|
+
def cucumber_compatible_arity?(args, block)
|
31
|
+
a = cucumber_arity(block)
|
32
|
+
return true if (a == -1) && Cucumber::RUBY_1_9
|
33
|
+
a == args.length
|
34
|
+
end
|
35
|
+
|
23
36
|
def cucumber_run_with_backtrace_filtering(pseudo_method)
|
24
37
|
begin
|
25
38
|
yield
|
@@ -6,12 +6,20 @@ if Cucumber::WINDOWS_MRI
|
|
6
6
|
gem 'win32console', '>= 1.2.0'
|
7
7
|
require 'Win32/Console/ANSI'
|
8
8
|
rescue LoadError
|
9
|
-
STDERR.puts
|
9
|
+
STDERR.puts %{*** WARNING: You must "gem install win32console" (1.2.0 or higher) to get coloured output on MRI/Windows}
|
10
|
+
Term::ANSIColor.coloring = false
|
11
|
+
end
|
12
|
+
elsif Cucumber::WINDOWS && Cucumber::JRUBY
|
13
|
+
begin
|
14
|
+
gem 'aslakhellesoy-ansicolor', '>= 1.0'
|
15
|
+
require 'ansicolor'
|
16
|
+
rescue LoadError
|
17
|
+
STDERR.puts %{*** WARNING: You must "gem install aslakhellesoy-ansicolor --source http://gems.github.com" (1.0 or higher) to get coloured output on JRuby/Windows}
|
10
18
|
Term::ANSIColor.coloring = false
|
11
19
|
end
|
12
20
|
end
|
13
21
|
|
14
|
-
Term::ANSIColor.coloring = false if !STDOUT.tty?
|
22
|
+
Term::ANSIColor.coloring = false if !STDOUT.tty?
|
15
23
|
|
16
24
|
module Cucumber
|
17
25
|
module Formatter
|
@@ -74,7 +74,8 @@ module Cucumber
|
|
74
74
|
return if undefined.empty?
|
75
75
|
snippets = undefined.map do |step|
|
76
76
|
step_name = Undefined === step.exception ? step.exception.step_name : step.name
|
77
|
-
|
77
|
+
step_multiline_class = step.multiline_arg ? step.multiline_arg.class : nil
|
78
|
+
snippet = @step_mother.snippet_text(step.actual_keyword, step_name, step_multiline_class)
|
78
79
|
snippet
|
79
80
|
end.compact.uniq
|
80
81
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'erb'
|
1
2
|
begin
|
2
3
|
require 'builder'
|
3
4
|
rescue LoadError
|
@@ -8,6 +9,8 @@ end
|
|
8
9
|
module Cucumber
|
9
10
|
module Formatter
|
10
11
|
class Html < Ast::Visitor
|
12
|
+
include ERB::Util # for the #h method
|
13
|
+
|
11
14
|
def initialize(step_mother, io, options)
|
12
15
|
super(step_mother)
|
13
16
|
@builder = Builder::XmlMarkup.new(:target => io, :indent => 2)
|
@@ -74,9 +77,11 @@ module Cucumber
|
|
74
77
|
end
|
75
78
|
|
76
79
|
def visit_outline_table(outline_table)
|
80
|
+
@outline_row = 0
|
77
81
|
@builder.table do
|
78
82
|
super(outline_table)
|
79
83
|
end
|
84
|
+
@outline_row = nil
|
80
85
|
end
|
81
86
|
|
82
87
|
def visit_examples_name(keyword, name)
|
@@ -91,8 +96,13 @@ module Cucumber
|
|
91
96
|
|
92
97
|
def visit_step(step)
|
93
98
|
@step_id = step.dom_id
|
94
|
-
|
95
|
-
|
99
|
+
super
|
100
|
+
end
|
101
|
+
|
102
|
+
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
103
|
+
@status = status
|
104
|
+
@builder.li(:id => @step_id, :class => status) do
|
105
|
+
super(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
96
106
|
end
|
97
107
|
end
|
98
108
|
|
@@ -103,8 +113,8 @@ module Cucumber
|
|
103
113
|
|
104
114
|
unless @skip_step
|
105
115
|
step_name = step_match.format_args(lambda{|param| "<span>#{param}</span>"})
|
106
|
-
@builder.div
|
107
|
-
div << "#{keyword} #{step_name}"
|
116
|
+
@builder.div do |div|
|
117
|
+
div << h("#{keyword} #{step_name}")
|
108
118
|
end
|
109
119
|
end
|
110
120
|
end
|
@@ -124,8 +134,8 @@ module Cucumber
|
|
124
134
|
end
|
125
135
|
end
|
126
136
|
|
127
|
-
def visit_py_string(string
|
128
|
-
@builder.pre(:class => status) do |pre|
|
137
|
+
def visit_py_string(string)
|
138
|
+
@builder.pre(:class => @status) do |pre|
|
129
139
|
pre << string
|
130
140
|
end
|
131
141
|
end
|
@@ -145,10 +155,14 @@ module Cucumber
|
|
145
155
|
end
|
146
156
|
end
|
147
157
|
end
|
158
|
+
@outline_row += 1 if @outline_row
|
148
159
|
end
|
149
160
|
|
150
161
|
def visit_table_cell_value(value, width, status)
|
151
|
-
@
|
162
|
+
cell_type = @outline_row == 0 ? :th : :td
|
163
|
+
attributes = {:id => "#{@row_id}_#{@col_index}"}
|
164
|
+
attributes[:class] = status if status
|
165
|
+
@builder.__send__(cell_type, value, attributes)
|
152
166
|
@col_index += 1
|
153
167
|
end
|
154
168
|
|
@@ -19,6 +19,7 @@ module Cucumber
|
|
19
19
|
@options = options
|
20
20
|
@delim = delim
|
21
21
|
@indent = 0
|
22
|
+
@exceptions = []
|
22
23
|
end
|
23
24
|
|
24
25
|
def visit_features(features)
|
@@ -119,26 +120,33 @@ module Cucumber
|
|
119
120
|
super
|
120
121
|
end
|
121
122
|
|
122
|
-
def
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
@step_matches << step_match
|
127
|
-
|
128
|
-
unless(@skip_step)
|
129
|
-
source_indent = nil unless @options[:source]
|
130
|
-
formatted_step_name = format_step(keyword, step_match, status, source_indent)
|
131
|
-
@io.puts(" " + formatted_step_name)
|
123
|
+
def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
124
|
+
if exception
|
125
|
+
return if @exceptions.index(exception)
|
126
|
+
@exceptions << exception
|
132
127
|
end
|
128
|
+
return if status != :failed && @in_background ^ background
|
129
|
+
|
130
|
+
# @step_matches ||= []
|
131
|
+
# return if @step_matches.index(step_match)
|
132
|
+
# @step_matches << step_match
|
133
|
+
|
134
|
+
@status = status
|
135
|
+
super
|
136
|
+
end
|
137
|
+
|
138
|
+
def visit_step_name(keyword, step_match, status, source_indent, background)
|
139
|
+
source_indent = nil unless @options[:source]
|
140
|
+
formatted_step_name = format_step(keyword, step_match, status, source_indent)
|
141
|
+
@io.puts(" " + formatted_step_name)
|
133
142
|
end
|
134
143
|
|
135
144
|
def visit_multiline_arg(multiline_arg)
|
136
|
-
return if @options[:no_multiline]
|
145
|
+
return if @options[:no_multiline]
|
137
146
|
super
|
138
147
|
end
|
139
148
|
|
140
149
|
def visit_exception(exception, status)
|
141
|
-
return if @skip_step
|
142
150
|
print_exception(exception, status, @indent)
|
143
151
|
@io.flush
|
144
152
|
end
|
@@ -147,21 +155,20 @@ module Cucumber
|
|
147
155
|
@io.print @delim.indent(@indent)
|
148
156
|
super
|
149
157
|
@io.puts
|
150
|
-
|
158
|
+
if table_row.exception && !@exceptions.index(table_row.exception)
|
159
|
+
print_exception(table_row.exception, :failed, @indent)
|
160
|
+
end
|
151
161
|
end
|
152
162
|
|
153
|
-
def visit_py_string(string
|
154
|
-
s = "
|
163
|
+
def visit_py_string(string)
|
164
|
+
s = %{"""\n#{string}\n"""}.indent(@indent)
|
155
165
|
s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}.join("\n")
|
156
|
-
@io.puts(format_string(s, status))
|
166
|
+
@io.puts(format_string(s, @status))
|
157
167
|
@io.flush
|
158
168
|
end
|
159
169
|
|
160
|
-
def visit_table_cell(table_cell)
|
161
|
-
super
|
162
|
-
end
|
163
|
-
|
164
170
|
def visit_table_cell_value(value, width, status)
|
171
|
+
status ||= @status || :passed
|
165
172
|
@io.print(' ' + format_string((value.to_s || '').ljust(width), status) + " #{@delim}")
|
166
173
|
@io.flush
|
167
174
|
end
|
@@ -10,6 +10,7 @@ module Cucumber
|
|
10
10
|
@io = io
|
11
11
|
@options = options
|
12
12
|
@step_definitions = Hash.new { |h,step_definition| h[step_definition] = [] }
|
13
|
+
@all_step_definitions = step_mother.step_definitions.dup
|
13
14
|
@locations = []
|
14
15
|
end
|
15
16
|
|
@@ -32,6 +33,7 @@ module Cucumber
|
|
32
33
|
description = format_step(keyword, step_match, status, nil)
|
33
34
|
length = (keyword + step_match.format_args).jlength
|
34
35
|
@step_definitions[step_match.step_definition] << [step_match, description, length, location]
|
36
|
+
@all_step_definitions.delete(step_match.step_definition)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -63,6 +65,20 @@ module Cucumber
|
|
63
65
|
@io.puts format_string(" # #{file_colon_line}".indent(max_length - length), :comment)
|
64
66
|
end
|
65
67
|
end
|
68
|
+
|
69
|
+
print_unused_step_definitions
|
70
|
+
end
|
71
|
+
|
72
|
+
def print_unused_step_definitions
|
73
|
+
if @all_step_definitions.any?
|
74
|
+
max_length = @all_step_definitions.map{|step_definition| step_definition.text_length}.max
|
75
|
+
|
76
|
+
@io.puts format_string("(::) UNUSED (::)", :failed)
|
77
|
+
@all_step_definitions.each do |step_definition|
|
78
|
+
@io.print format_string(step_definition.regexp.inspect, :failed)
|
79
|
+
@io.puts format_string(" # #{step_definition.file_colon_line}".indent(max_length - step_definition.text_length), :comment)
|
80
|
+
end
|
81
|
+
end
|
66
82
|
end
|
67
83
|
end
|
68
84
|
end
|