kosmas58-cucumber 0.2.3.3 → 0.3.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +203 -3
- data/Manifest.txt +0 -346
- data/README.txt +0 -21
- data/Rakefile +3 -1
- data/bin/cucumber +12 -1
- data/config/hoe.rb +6 -5
- data/cucumber.yml +3 -1
- data/examples/cs/Rakefile +1 -1
- data/examples/cs/features/addition.feature +5 -5
- data/examples/cs/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/dos_line_endings/Rakefile +1 -1
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -9
- data/examples/i18n/Rakefile +1 -1
- data/examples/i18n/ar/Rakefile +1 -1
- data/examples/i18n/bg/Rakefile +6 -0
- data/examples/i18n/bg/features/addition.feature +11 -0
- data/examples/i18n/bg/features/consecutive_calculations.feature +18 -0
- data/examples/i18n/bg/features/division.feature +16 -0
- data/examples/i18n/bg/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/bg/features/support/env.rb +6 -0
- data/examples/i18n/bg/features/support/world.rb +8 -0
- data/examples/i18n/bg/lib/calculator.rb +24 -0
- data/examples/i18n/cat/Rakefile +6 -0
- data/examples/i18n/cat/features/step_definitons/calculator_steps.rb +21 -0
- data/examples/i18n/cat/features/suma.feature +16 -0
- data/examples/i18n/cat/lib/calculadora.rb +16 -0
- data/examples/i18n/da/Rakefile +1 -1
- data/examples/i18n/de/Rakefile +1 -1
- data/examples/i18n/en/Rakefile +1 -1
- data/examples/i18n/en-lol/Rakefile +1 -1
- data/examples/i18n/es/Rakefile +1 -1
- data/examples/i18n/et/Rakefile +1 -1
- data/examples/i18n/fi/Rakefile +1 -1
- data/examples/i18n/fr/Rakefile +1 -1
- data/examples/i18n/fr/features/addition.feature +4 -4
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/fr/lib/calculatrice.rb +1 -1
- data/examples/i18n/he/Rakefile +6 -0
- data/examples/i18n/he/features/addition.feature +16 -0
- data/examples/i18n/he/features/division.feature +9 -0
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/he/lib/calculator.rb +14 -0
- data/examples/i18n/hu/Rakefile +6 -0
- data/examples/i18n/hu/features/addition.feature +16 -0
- data/examples/i18n/hu/features/division.feature +9 -0
- data/examples/i18n/hu/features/step_definitons/calculator_steps.rb +25 -0
- data/examples/i18n/hu/lib/calculator.rb +14 -0
- data/examples/i18n/id/Rakefile +1 -1
- data/examples/i18n/it/Rakefile +1 -1
- data/examples/i18n/ja/Rakefile +1 -1
- data/examples/i18n/ja/features/addition.feature +1 -1
- data/examples/i18n/ja/features/division.feature +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ko/Rakefile +1 -1
- data/examples/i18n/lt/Rakefile +1 -1
- data/examples/i18n/lt/features/addition.feature +2 -3
- data/examples/i18n/lv/Rakefile +6 -0
- data/examples/i18n/lv/features/addition.feature +16 -0
- data/examples/i18n/lv/features/division.feature +9 -0
- data/examples/i18n/lv/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/lv/lib/calculator.rb +14 -0
- data/examples/i18n/no/Rakefile +1 -1
- data/examples/i18n/pl/Rakefile +6 -0
- data/examples/i18n/pl/features/addition.feature +16 -0
- data/examples/i18n/pl/features/division.feature +9 -0
- data/examples/i18n/pl/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/pl/features/support/env.rb +6 -0
- data/examples/i18n/pl/lib/calculator.rb +14 -0
- data/examples/i18n/pt/Rakefile +1 -1
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +3 -7
- data/examples/i18n/pt/features/support/env.rb +6 -0
- data/examples/i18n/ro/Rakefile +1 -1
- data/examples/i18n/ru/Rakefile +1 -1
- data/examples/i18n/se/Rakefile +1 -1
- data/examples/i18n/sk/Rakefile +1 -1
- data/examples/i18n/zh-CN/Rakefile +1 -1
- data/examples/i18n/zh-TW/Rakefile +1 -1
- data/examples/java/README.textile +2 -6
- data/examples/java/build.xml +33 -0
- data/examples/java/features/step_definitons/hello_steps.rb +0 -2
- data/examples/junit/features/one_passing_one_failing.feature +8 -0
- data/examples/junit/features/pending.feature +5 -0
- data/examples/junit/features/step_definitions/steps.rb +11 -0
- data/examples/selenium/Rakefile +1 -1
- data/examples/selenium_webrat/Rakefile +1 -1
- data/examples/selenium_webrat/config.ru +0 -0
- data/examples/selenium_webrat/features/search.feature +1 -1
- data/examples/selenium_webrat/features/step_definitons/search_steps.rb +2 -2
- data/examples/selenium_webrat/features/support/env.rb +7 -3
- data/examples/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/examples/self_test/features/background/failing_background.feature +1 -0
- data/examples/self_test/features/background/passing_background.feature +2 -2
- data/examples/self_test/features/multiline_name.feature +27 -0
- data/examples/self_test/features/sample.feature +2 -0
- data/examples/self_test/features/search_sample.feature +32 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +11 -0
- data/examples/self_test/features/support/env.rb +17 -1
- data/examples/sinatra/Rakefile +1 -1
- data/examples/test_unit/Rakefile +1 -1
- data/examples/tickets/Rakefile +3 -3
- data/examples/tickets/features/229/tagged_hooks.feature +8 -0
- data/examples/tickets/features/229/tagged_hooks.rb +14 -0
- data/examples/tickets/features/236.feature +9 -9
- data/examples/tickets/features/272/hooks.feature +26 -0
- data/examples/tickets/features/272/hooks_steps.rb +53 -0
- data/examples/tickets/features/279/py_string_indent.feature +25 -0
- data/examples/tickets/features/279/py_string_indent.steps.rb +12 -0
- data/examples/tickets/features/279/wrong.feature_ +11 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks.feature +6 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks_steps.rb +12 -0
- data/examples/tickets/features/306/only_background.feature +4 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -7
- data/examples/watir/Rakefile +1 -1
- data/examples/watir/features/search.feature +4 -1
- data/examples/watir/features/step_definitons/search_steps.rb +2 -4
- data/features/after_block_exceptions.feature +99 -0
- data/features/after_step_block_exceptions.feature +101 -0
- data/features/background.feature +105 -38
- data/features/cucumber_cli.feature +201 -64
- data/features/cucumber_cli_diff_disabled.feature +6 -4
- data/features/cucumber_cli_outlines.feature +60 -35
- data/features/custom_formatter.feature +3 -3
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +48 -0
- data/features/html_formatter/a.html +1632 -0
- data/features/html_formatter.feature +7 -0
- data/features/junit_formatter.feature +62 -0
- data/features/multiline_names.feature +43 -0
- data/features/rake_task.feature +150 -0
- data/features/report_called_undefined_steps.feature +4 -3
- data/features/snippet.feature +2 -3
- data/features/step_definitions/cucumber_steps.rb +98 -15
- data/features/support/env.rb +78 -3
- data/features/usage.feature +32 -19
- data/features/work_in_progress.feature +148 -0
- data/gem_tasks/deployment.rake +1 -1
- data/gem_tasks/rspec.rake +9 -2
- data/lib/cucumber/ast/background.rb +19 -7
- data/lib/cucumber/ast/comment.rb +4 -0
- data/lib/cucumber/ast/feature.rb +7 -1
- data/lib/cucumber/ast/feature_element.rb +24 -9
- data/lib/cucumber/ast/features.rb +4 -0
- data/lib/cucumber/ast/outline_table.rb +74 -4
- data/lib/cucumber/ast/py_string.rb +5 -1
- data/lib/cucumber/ast/scenario.rb +31 -7
- data/lib/cucumber/ast/scenario_outline.rb +17 -9
- data/lib/cucumber/ast/step.rb +8 -5
- data/lib/cucumber/ast/step_collection.rb +14 -1
- data/lib/cucumber/ast/step_invocation.rb +29 -15
- data/lib/cucumber/ast/table.rb +9 -1
- data/lib/cucumber/ast/tags.rb +9 -1
- data/lib/cucumber/ast/visitor.rb +6 -2
- data/lib/cucumber/cli/configuration.rb +134 -105
- data/lib/cucumber/cli/main.rb +35 -12
- data/lib/cucumber/core_ext/proc.rb +9 -13
- data/lib/cucumber/formatter/ansicolor.rb +1 -1
- data/lib/cucumber/formatter/console.rb +36 -14
- data/lib/cucumber/formatter/cucumber.css +31 -12
- data/lib/cucumber/formatter/duration.rb +10 -0
- data/lib/cucumber/formatter/html.rb +76 -16
- data/lib/cucumber/formatter/junit.rb +79 -0
- data/lib/cucumber/formatter/pretty.rb +19 -14
- data/lib/cucumber/formatter/profile.rb +1 -1
- data/lib/cucumber/formatter/progress.rb +12 -12
- data/lib/cucumber/formatter/rerun.rb +1 -0
- data/lib/cucumber/formatter/tag_cloud.rb +28 -0
- data/lib/cucumber/formatter/usage.rb +5 -5
- data/lib/cucumber/formatters/unicode.rb +5 -0
- data/lib/cucumber/languages.yml +111 -34
- data/lib/cucumber/parser/feature.rb +237 -36
- data/lib/cucumber/parser/feature.tt +68 -30
- data/lib/cucumber/parser/treetop_ext.rb +12 -3
- data/lib/cucumber/rails/rspec.rb +5 -3
- data/lib/cucumber/rails/world.rb +29 -4
- data/lib/cucumber/rake/task.rb +125 -37
- data/lib/cucumber/rspec_neuter.rb +23 -0
- data/lib/cucumber/step_definition.rb +5 -2
- data/lib/cucumber/step_match.rb +10 -6
- data/lib/cucumber/step_mother.rb +98 -26
- data/lib/cucumber/version.rb +3 -3
- data/lib/cucumber/world.rb +2 -2
- data/lib/cucumber.rb +7 -2
- data/rails_generators/cucumber/USAGE +0 -3
- data/rails_generators/cucumber/cucumber_generator.rb +51 -44
- data/rails_generators/cucumber/templates/cucumber.rake +5 -5
- data/rails_generators/cucumber/templates/cucumber_environment.rb +23 -0
- data/rails_generators/cucumber/templates/de/paths.rb +27 -0
- data/rails_generators/cucumber/templates/de/webrat_steps.rb +139 -0
- data/rails_generators/cucumber/templates/en/paths.rb +27 -0
- data/rails_generators/cucumber/templates/{webrat_steps.rb → en/webrat_steps.rb} +26 -2
- data/rails_generators/cucumber/templates/env.rb +1 -1
- data/rails_generators/feature/USAGE +0 -3
- data/rails_generators/feature/feature_generator.rb +6 -30
- data/spec/cucumber/ast/feature_element_spec.rb +40 -0
- data/spec/cucumber/ast/py_string_spec.rb +4 -0
- data/spec/cucumber/ast/table_spec.rb +21 -5
- data/spec/cucumber/ast/visitor_spec.rb +27 -0
- data/spec/cucumber/cli/configuration_spec.rb +75 -54
- data/spec/cucumber/cli/main_spec.rb +60 -154
- data/spec/cucumber/formatter/color_io_spec.rb +1 -0
- data/spec/cucumber/formatter/duration_spec.rb +22 -0
- data/spec/cucumber/formatter/progress_spec.rb +36 -0
- data/spec/cucumber/parser/feature_parser_spec.rb +102 -1
- data/spec/cucumber/step_mother_spec.rb +23 -5
- metadata +79 -22
- data/examples/java/Rakefile +0 -12
- data/examples/self_test/features/support/tag_count_formatter.rb +0 -25
- data/lib/cucumber/formatter.rb +0 -1
- data/rails_generators/cucumber/templates/paths.rb +0 -29
- data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
@@ -61,8 +61,8 @@ module Cucumber
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def build(filter)
|
64
|
-
if(filter.nil? || feature_elements.accept?(filter))
|
65
|
-
background = bg.respond_to?(:build) ? bg.build : nil
|
64
|
+
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
|
65
|
+
background = bg.respond_to?(:build) ? bg.build : nil
|
66
66
|
Ast::Feature.new(
|
67
67
|
background,
|
68
68
|
comment.build,
|
@@ -216,7 +216,7 @@ module Cucumber
|
|
216
216
|
end
|
217
217
|
|
218
218
|
def has_tags?(tags)
|
219
|
-
tag_names
|
219
|
+
(tag_names & tags).any?
|
220
220
|
end
|
221
221
|
|
222
222
|
def build
|
@@ -224,7 +224,7 @@ module Cucumber
|
|
224
224
|
end
|
225
225
|
|
226
226
|
def tag_names
|
227
|
-
ts.elements.map{|e| e.tag.tag_name.text_value}
|
227
|
+
@tag_names ||= ts.elements.map{|e| e.tag.tag_name.text_value}
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
@@ -481,15 +481,29 @@ module Cucumber
|
|
481
481
|
end
|
482
482
|
|
483
483
|
module Background1
|
484
|
+
def matches_name?(regexp_to_match)
|
485
|
+
name.build =~ regexp_to_match
|
486
|
+
end
|
487
|
+
|
488
|
+
def at_line?(line)
|
489
|
+
background_keyword.line == line ||
|
490
|
+
steps.at_line?(line)
|
491
|
+
end
|
492
|
+
|
493
|
+
def has_tags?(tag_names)
|
494
|
+
feature_tags = self.parent.tags
|
495
|
+
feature_tags.has_tags?(tag_names)
|
496
|
+
end
|
497
|
+
|
484
498
|
def build
|
485
499
|
Ast::Background.new(
|
486
500
|
comment.build,
|
487
501
|
background_keyword.line,
|
488
502
|
background_keyword.text_value,
|
489
|
-
name.
|
503
|
+
name.build,
|
490
504
|
steps.build
|
491
505
|
)
|
492
|
-
|
506
|
+
end
|
493
507
|
end
|
494
508
|
|
495
509
|
def _nt_background
|
@@ -522,7 +536,7 @@ module Cucumber
|
|
522
536
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
523
537
|
s0 << r4
|
524
538
|
if r4
|
525
|
-
r7 =
|
539
|
+
r7 = _nt_lines_to_keyword
|
526
540
|
if r7
|
527
541
|
r6 = r7
|
528
542
|
else
|
@@ -678,8 +692,8 @@ module Cucumber
|
|
678
692
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
679
693
|
end
|
680
694
|
|
681
|
-
def matches_name?(
|
682
|
-
name.
|
695
|
+
def matches_name?(regexp_to_match)
|
696
|
+
name.build =~ regexp_to_match
|
683
697
|
end
|
684
698
|
|
685
699
|
def build(background, filter)
|
@@ -689,7 +703,7 @@ module Cucumber
|
|
689
703
|
tags.build,
|
690
704
|
scenario_keyword.line,
|
691
705
|
scenario_keyword.text_value,
|
692
|
-
name.
|
706
|
+
name.build,
|
693
707
|
steps.build
|
694
708
|
)
|
695
709
|
end
|
@@ -728,7 +742,7 @@ module Cucumber
|
|
728
742
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
729
743
|
s0 << r5
|
730
744
|
if r5
|
731
|
-
r7 =
|
745
|
+
r7 = _nt_lines_to_keyword
|
732
746
|
s0 << r7
|
733
747
|
if r7
|
734
748
|
r8 = _nt_white
|
@@ -816,8 +830,12 @@ module Cucumber
|
|
816
830
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
817
831
|
end
|
818
832
|
|
819
|
-
def matches_name?(
|
820
|
-
|
833
|
+
def matches_name?(regexp_to_match)
|
834
|
+
outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
|
835
|
+
end
|
836
|
+
|
837
|
+
def outline_matches_name?(regexp_to_match)
|
838
|
+
name.build =~ regexp_to_match
|
821
839
|
end
|
822
840
|
|
823
841
|
def build(background, filter)
|
@@ -827,7 +845,7 @@ module Cucumber
|
|
827
845
|
tags.build,
|
828
846
|
scenario_outline_keyword.line,
|
829
847
|
scenario_outline_keyword.text_value,
|
830
|
-
name.
|
848
|
+
name.build,
|
831
849
|
steps.build,
|
832
850
|
examples_sections.build(filter, self)
|
833
851
|
)
|
@@ -867,7 +885,7 @@ module Cucumber
|
|
867
885
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
868
886
|
s0 << r5
|
869
887
|
if r5
|
870
|
-
r7 =
|
888
|
+
r7 = _nt_lines_to_keyword
|
871
889
|
s0 << r7
|
872
890
|
if r7
|
873
891
|
r8 = _nt_white
|
@@ -1078,9 +1096,13 @@ module Cucumber
|
|
1078
1096
|
elements.detect { |e| e.at_line?(line) }
|
1079
1097
|
end
|
1080
1098
|
|
1099
|
+
def matches_name?(regexp_to_match)
|
1100
|
+
elements.detect { |e| e.matches_name?(regexp_to_match) }
|
1101
|
+
end
|
1102
|
+
|
1081
1103
|
def build(filter, scenario_outline)
|
1082
1104
|
elements.map do |e|
|
1083
|
-
if(filter.nil? || filter.
|
1105
|
+
if(filter.nil? || filter.accept_example?(e, scenario_outline))
|
1084
1106
|
e.build(filter, scenario_outline)
|
1085
1107
|
end
|
1086
1108
|
end.compact
|
@@ -1148,8 +1170,12 @@ module Cucumber
|
|
1148
1170
|
true
|
1149
1171
|
end
|
1150
1172
|
|
1173
|
+
def matches_name?(regexp_to_match)
|
1174
|
+
name.build =~ regexp_to_match
|
1175
|
+
end
|
1176
|
+
|
1151
1177
|
def build(filter, scenario_outline)
|
1152
|
-
[examples_keyword.line, examples_keyword.text_value, name.
|
1178
|
+
[examples_keyword.line, examples_keyword.text_value, name.build, table.raw(filter, scenario_outline)]
|
1153
1179
|
end
|
1154
1180
|
end
|
1155
1181
|
|
@@ -1189,7 +1215,7 @@ module Cucumber
|
|
1189
1215
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1190
1216
|
s0 << r4
|
1191
1217
|
if r4
|
1192
|
-
r7 =
|
1218
|
+
r7 = _nt_lines_to_keyword
|
1193
1219
|
if r7
|
1194
1220
|
r6 = r7
|
1195
1221
|
else
|
@@ -1305,6 +1331,172 @@ module Cucumber
|
|
1305
1331
|
return r0
|
1306
1332
|
end
|
1307
1333
|
|
1334
|
+
module LinesToKeyword0
|
1335
|
+
def eol
|
1336
|
+
elements[0]
|
1337
|
+
end
|
1338
|
+
|
1339
|
+
def reserved_words_and_symbols
|
1340
|
+
elements[2]
|
1341
|
+
end
|
1342
|
+
end
|
1343
|
+
|
1344
|
+
module LinesToKeyword1
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
module LinesToKeyword2
|
1348
|
+
def build
|
1349
|
+
self.text_value.split("\n").map{|s| s.strip }.join("\n")
|
1350
|
+
end
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
def _nt_lines_to_keyword
|
1354
|
+
start_index = index
|
1355
|
+
if node_cache[:lines_to_keyword].has_key?(index)
|
1356
|
+
cached = node_cache[:lines_to_keyword][index]
|
1357
|
+
@index = cached.interval.end if cached
|
1358
|
+
return cached
|
1359
|
+
end
|
1360
|
+
|
1361
|
+
s0, i0 = [], index
|
1362
|
+
loop do
|
1363
|
+
i1, s1 = index, []
|
1364
|
+
i2 = index
|
1365
|
+
i3, s3 = index, []
|
1366
|
+
r4 = _nt_eol
|
1367
|
+
s3 << r4
|
1368
|
+
if r4
|
1369
|
+
s5, i5 = [], index
|
1370
|
+
loop do
|
1371
|
+
r6 = _nt_space
|
1372
|
+
if r6
|
1373
|
+
s5 << r6
|
1374
|
+
else
|
1375
|
+
break
|
1376
|
+
end
|
1377
|
+
end
|
1378
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
1379
|
+
s3 << r5
|
1380
|
+
if r5
|
1381
|
+
r7 = _nt_reserved_words_and_symbols
|
1382
|
+
s3 << r7
|
1383
|
+
end
|
1384
|
+
end
|
1385
|
+
if s3.last
|
1386
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
1387
|
+
r3.extend(LinesToKeyword0)
|
1388
|
+
else
|
1389
|
+
self.index = i3
|
1390
|
+
r3 = nil
|
1391
|
+
end
|
1392
|
+
if r3
|
1393
|
+
r2 = nil
|
1394
|
+
else
|
1395
|
+
self.index = i2
|
1396
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1397
|
+
end
|
1398
|
+
s1 << r2
|
1399
|
+
if r2
|
1400
|
+
if index < input_length
|
1401
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1402
|
+
@index += 1
|
1403
|
+
else
|
1404
|
+
terminal_parse_failure("any character")
|
1405
|
+
r8 = nil
|
1406
|
+
end
|
1407
|
+
s1 << r8
|
1408
|
+
end
|
1409
|
+
if s1.last
|
1410
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1411
|
+
r1.extend(LinesToKeyword1)
|
1412
|
+
else
|
1413
|
+
self.index = i1
|
1414
|
+
r1 = nil
|
1415
|
+
end
|
1416
|
+
if r1
|
1417
|
+
s0 << r1
|
1418
|
+
else
|
1419
|
+
break
|
1420
|
+
end
|
1421
|
+
end
|
1422
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1423
|
+
r0.extend(LinesToKeyword2)
|
1424
|
+
|
1425
|
+
node_cache[:lines_to_keyword][start_index] = r0
|
1426
|
+
|
1427
|
+
return r0
|
1428
|
+
end
|
1429
|
+
|
1430
|
+
module ReservedWordsAndSymbols0
|
1431
|
+
def step_keyword
|
1432
|
+
elements[0]
|
1433
|
+
end
|
1434
|
+
|
1435
|
+
def keyword_space
|
1436
|
+
elements[1]
|
1437
|
+
end
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
def _nt_reserved_words_and_symbols
|
1441
|
+
start_index = index
|
1442
|
+
if node_cache[:reserved_words_and_symbols].has_key?(index)
|
1443
|
+
cached = node_cache[:reserved_words_and_symbols][index]
|
1444
|
+
@index = cached.interval.end if cached
|
1445
|
+
return cached
|
1446
|
+
end
|
1447
|
+
|
1448
|
+
i0 = index
|
1449
|
+
i1, s1 = index, []
|
1450
|
+
r2 = _nt_step_keyword
|
1451
|
+
s1 << r2
|
1452
|
+
if r2
|
1453
|
+
r3 = _nt_keyword_space
|
1454
|
+
s1 << r3
|
1455
|
+
end
|
1456
|
+
if s1.last
|
1457
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1458
|
+
r1.extend(ReservedWordsAndSymbols0)
|
1459
|
+
else
|
1460
|
+
self.index = i1
|
1461
|
+
r1 = nil
|
1462
|
+
end
|
1463
|
+
if r1
|
1464
|
+
r0 = r1
|
1465
|
+
else
|
1466
|
+
r4 = _nt_scenario_keyword
|
1467
|
+
if r4
|
1468
|
+
r0 = r4
|
1469
|
+
else
|
1470
|
+
r5 = _nt_scenario_outline_keyword
|
1471
|
+
if r5
|
1472
|
+
r0 = r5
|
1473
|
+
else
|
1474
|
+
r6 = _nt_table
|
1475
|
+
if r6
|
1476
|
+
r0 = r6
|
1477
|
+
else
|
1478
|
+
r7 = _nt_tag
|
1479
|
+
if r7
|
1480
|
+
r0 = r7
|
1481
|
+
else
|
1482
|
+
r8 = _nt_comment_line
|
1483
|
+
if r8
|
1484
|
+
r0 = r8
|
1485
|
+
else
|
1486
|
+
self.index = i0
|
1487
|
+
r0 = nil
|
1488
|
+
end
|
1489
|
+
end
|
1490
|
+
end
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
node_cache[:reserved_words_and_symbols][start_index] = r0
|
1496
|
+
|
1497
|
+
return r0
|
1498
|
+
end
|
1499
|
+
|
1308
1500
|
module PyString0
|
1309
1501
|
end
|
1310
1502
|
|
@@ -1401,7 +1593,7 @@ module Cucumber
|
|
1401
1593
|
end
|
1402
1594
|
|
1403
1595
|
module OpenPyString0
|
1404
|
-
def
|
1596
|
+
def indent
|
1405
1597
|
elements[0]
|
1406
1598
|
end
|
1407
1599
|
|
@@ -1412,11 +1604,11 @@ module Cucumber
|
|
1412
1604
|
|
1413
1605
|
module OpenPyString1
|
1414
1606
|
def indentation
|
1415
|
-
|
1607
|
+
indent.text_value.length
|
1416
1608
|
end
|
1417
1609
|
|
1418
1610
|
def line
|
1419
|
-
|
1611
|
+
indent.line
|
1420
1612
|
end
|
1421
1613
|
end
|
1422
1614
|
|
@@ -1429,32 +1621,41 @@ module Cucumber
|
|
1429
1621
|
end
|
1430
1622
|
|
1431
1623
|
i0, s0 = index, []
|
1432
|
-
|
1624
|
+
s1, i1 = [], index
|
1625
|
+
loop do
|
1626
|
+
r2 = _nt_space
|
1627
|
+
if r2
|
1628
|
+
s1 << r2
|
1629
|
+
else
|
1630
|
+
break
|
1631
|
+
end
|
1632
|
+
end
|
1633
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1433
1634
|
s0 << r1
|
1434
1635
|
if r1
|
1435
1636
|
if input.index('"""', index) == index
|
1436
|
-
|
1637
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1437
1638
|
@index += 3
|
1438
1639
|
else
|
1439
1640
|
terminal_parse_failure('"""')
|
1440
|
-
|
1641
|
+
r3 = nil
|
1441
1642
|
end
|
1442
|
-
s0 <<
|
1443
|
-
if
|
1444
|
-
|
1643
|
+
s0 << r3
|
1644
|
+
if r3
|
1645
|
+
s4, i4 = [], index
|
1445
1646
|
loop do
|
1446
|
-
|
1447
|
-
if
|
1448
|
-
|
1647
|
+
r5 = _nt_space
|
1648
|
+
if r5
|
1649
|
+
s4 << r5
|
1449
1650
|
else
|
1450
1651
|
break
|
1451
1652
|
end
|
1452
1653
|
end
|
1453
|
-
|
1454
|
-
s0 <<
|
1455
|
-
if
|
1456
|
-
|
1457
|
-
s0 <<
|
1654
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1655
|
+
s0 << r4
|
1656
|
+
if r4
|
1657
|
+
r6 = _nt_eol
|
1658
|
+
s0 << r6
|
1458
1659
|
end
|
1459
1660
|
end
|
1460
1661
|
end
|
@@ -1587,4 +1788,4 @@ module Cucumber
|
|
1587
1788
|
end
|
1588
1789
|
|
1589
1790
|
end
|
1590
|
-
end
|
1791
|
+
end
|
@@ -25,8 +25,8 @@ module Cucumber
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def build(filter)
|
28
|
-
if(filter.nil? || feature_elements.accept?(filter))
|
29
|
-
background = bg.respond_to?(:build) ? bg.build : nil
|
28
|
+
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
|
29
|
+
background = bg.respond_to?(:build) ? bg.build : nil
|
30
30
|
Ast::Feature.new(
|
31
31
|
background,
|
32
32
|
comment.build,
|
@@ -46,7 +46,7 @@ module Cucumber
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def has_tags?(tags)
|
49
|
-
tag_names
|
49
|
+
(tag_names & tags).any?
|
50
50
|
end
|
51
51
|
|
52
52
|
def build
|
@@ -54,7 +54,7 @@ module Cucumber
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def tag_names
|
57
|
-
ts.elements.map{|e| e.tag.tag_name.text_value}
|
57
|
+
@tag_names ||= ts.elements.map{|e| e.tag.tag_name.text_value}
|
58
58
|
end
|
59
59
|
}
|
60
60
|
end
|
@@ -76,17 +76,31 @@ module Cucumber
|
|
76
76
|
end
|
77
77
|
|
78
78
|
rule background
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
79
|
+
comment white background_keyword space* name:lines_to_keyword? (eol+ / eof) steps {
|
80
|
+
def matches_name?(regexp_to_match)
|
81
|
+
name.build =~ regexp_to_match
|
82
|
+
end
|
83
|
+
|
84
|
+
def at_line?(line)
|
85
|
+
background_keyword.line == line ||
|
86
|
+
steps.at_line?(line)
|
87
|
+
end
|
88
|
+
|
89
|
+
def has_tags?(tag_names)
|
90
|
+
feature_tags = self.parent.tags
|
91
|
+
feature_tags.has_tags?(tag_names)
|
92
|
+
end
|
93
|
+
|
94
|
+
def build
|
95
|
+
Ast::Background.new(
|
96
|
+
comment.build,
|
97
|
+
background_keyword.line,
|
98
|
+
background_keyword.text_value,
|
99
|
+
name.build,
|
100
|
+
steps.build
|
101
|
+
)
|
102
|
+
end
|
103
|
+
}
|
90
104
|
end
|
91
105
|
|
92
106
|
rule feature_elements
|
@@ -106,7 +120,7 @@ module Cucumber
|
|
106
120
|
end
|
107
121
|
|
108
122
|
rule scenario
|
109
|
-
comment tags white scenario_keyword space* name:
|
123
|
+
comment tags white scenario_keyword space* name:lines_to_keyword white steps white {
|
110
124
|
def at_line?(line)
|
111
125
|
scenario_keyword.line == line ||
|
112
126
|
steps.at_line?(line) ||
|
@@ -118,8 +132,8 @@ module Cucumber
|
|
118
132
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
119
133
|
end
|
120
134
|
|
121
|
-
def matches_name?(
|
122
|
-
name.
|
135
|
+
def matches_name?(regexp_to_match)
|
136
|
+
name.build =~ regexp_to_match
|
123
137
|
end
|
124
138
|
|
125
139
|
def build(background, filter)
|
@@ -129,7 +143,7 @@ module Cucumber
|
|
129
143
|
tags.build,
|
130
144
|
scenario_keyword.line,
|
131
145
|
scenario_keyword.text_value,
|
132
|
-
name.
|
146
|
+
name.build,
|
133
147
|
steps.build
|
134
148
|
)
|
135
149
|
end
|
@@ -137,7 +151,7 @@ module Cucumber
|
|
137
151
|
end
|
138
152
|
|
139
153
|
rule scenario_outline
|
140
|
-
comment tags white scenario_outline_keyword space* name:
|
154
|
+
comment tags white scenario_outline_keyword space* name:lines_to_keyword white steps examples_sections white {
|
141
155
|
def at_line?(line)
|
142
156
|
outline_at_line?(line) ||
|
143
157
|
examples_sections.at_line?(line) ||
|
@@ -154,8 +168,12 @@ module Cucumber
|
|
154
168
|
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
|
155
169
|
end
|
156
170
|
|
157
|
-
def matches_name?(
|
158
|
-
|
171
|
+
def matches_name?(regexp_to_match)
|
172
|
+
outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
|
173
|
+
end
|
174
|
+
|
175
|
+
def outline_matches_name?(regexp_to_match)
|
176
|
+
name.build =~ regexp_to_match
|
159
177
|
end
|
160
178
|
|
161
179
|
def build(background, filter)
|
@@ -165,7 +183,7 @@ module Cucumber
|
|
165
183
|
tags.build,
|
166
184
|
scenario_outline_keyword.line,
|
167
185
|
scenario_outline_keyword.text_value,
|
168
|
-
name.
|
186
|
+
name.build,
|
169
187
|
steps.build,
|
170
188
|
examples_sections.build(filter, self)
|
171
189
|
)
|
@@ -208,9 +226,13 @@ module Cucumber
|
|
208
226
|
elements.detect { |e| e.at_line?(line) }
|
209
227
|
end
|
210
228
|
|
229
|
+
def matches_name?(regexp_to_match)
|
230
|
+
elements.detect { |e| e.matches_name?(regexp_to_match) }
|
231
|
+
end
|
232
|
+
|
211
233
|
def build(filter, scenario_outline)
|
212
234
|
elements.map do |e|
|
213
|
-
if(filter.nil? || filter.
|
235
|
+
if(filter.nil? || filter.accept_example?(e, scenario_outline))
|
214
236
|
e.build(filter, scenario_outline)
|
215
237
|
end
|
216
238
|
end.compact
|
@@ -219,7 +241,7 @@ module Cucumber
|
|
219
241
|
end
|
220
242
|
|
221
243
|
rule examples
|
222
|
-
space* examples_keyword space* name:
|
244
|
+
space* examples_keyword space* name:lines_to_keyword? eol table white {
|
223
245
|
def at_line?(line)
|
224
246
|
examples_keyword.line == line ||
|
225
247
|
table.at_line?(line)
|
@@ -233,8 +255,12 @@ module Cucumber
|
|
233
255
|
true
|
234
256
|
end
|
235
257
|
|
258
|
+
def matches_name?(regexp_to_match)
|
259
|
+
name.build =~ regexp_to_match
|
260
|
+
end
|
261
|
+
|
236
262
|
def build(filter, scenario_outline)
|
237
|
-
[examples_keyword.line, examples_keyword.text_value, name.
|
263
|
+
[examples_keyword.line, examples_keyword.text_value, name.build, table.raw(filter, scenario_outline)]
|
238
264
|
end
|
239
265
|
}
|
240
266
|
end
|
@@ -247,6 +273,18 @@ module Cucumber
|
|
247
273
|
(!eol .)*
|
248
274
|
end
|
249
275
|
|
276
|
+
rule lines_to_keyword
|
277
|
+
(!(eol space* reserved_words_and_symbols) .)* {
|
278
|
+
def build
|
279
|
+
self.text_value.split("\n").map{|s| s.strip}.join("\n")
|
280
|
+
end
|
281
|
+
}
|
282
|
+
end
|
283
|
+
|
284
|
+
rule reserved_words_and_symbols
|
285
|
+
(step_keyword keyword_space) / scenario_keyword / scenario_outline_keyword / table / tag / comment_line
|
286
|
+
end
|
287
|
+
|
250
288
|
rule py_string
|
251
289
|
open_py_string s:(!close_py_string .)* close_py_string {
|
252
290
|
def at_line?(line)
|
@@ -260,13 +298,13 @@ module Cucumber
|
|
260
298
|
end
|
261
299
|
|
262
300
|
rule open_py_string
|
263
|
-
|
301
|
+
indent:space* '"""' space* eol {
|
264
302
|
def indentation
|
265
|
-
|
303
|
+
indent.text_value.length
|
266
304
|
end
|
267
305
|
|
268
306
|
def line
|
269
|
-
|
307
|
+
indent.line
|
270
308
|
end
|
271
309
|
}
|
272
310
|
end
|
@@ -285,4 +323,4 @@ module Cucumber
|
|
285
323
|
|
286
324
|
end
|
287
325
|
end
|
288
|
-
end
|
326
|
+
end
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
17
17
|
@lines = lines
|
18
18
|
@include_tags = options[:include_tags] || []
|
19
19
|
@exclude_tags = options[:exclude_tags] || []
|
20
|
-
@
|
20
|
+
@name_regexps = options[:name_regexps] || []
|
21
21
|
end
|
22
22
|
|
23
23
|
def accept?(syntax_node)
|
@@ -26,6 +26,11 @@ module Cucumber
|
|
26
26
|
matches_names?(syntax_node)
|
27
27
|
end
|
28
28
|
|
29
|
+
def accept_example?(syntax_node, outline)
|
30
|
+
(at_line?(syntax_node) || outline_at_line?(outline)) &&
|
31
|
+
(matches_names?(syntax_node) || outline_matches_names?(outline))
|
32
|
+
end
|
33
|
+
|
29
34
|
def at_line?(syntax_node)
|
30
35
|
@lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.at_line?(line)}
|
31
36
|
end
|
@@ -47,8 +52,12 @@ module Cucumber
|
|
47
52
|
@exclude_tags.any? && syntax_node.has_tags?(@exclude_tags)
|
48
53
|
end
|
49
54
|
|
55
|
+
def outline_matches_names?(syntax_node)
|
56
|
+
@name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.outline_matches_name?(name_regexp)}
|
57
|
+
end
|
58
|
+
|
50
59
|
def matches_names?(syntax_node)
|
51
|
-
@
|
60
|
+
@name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.matches_name?(name_regexp)}
|
52
61
|
end
|
53
62
|
end
|
54
63
|
|
@@ -111,4 +120,4 @@ module Treetop
|
|
111
120
|
include Cucumber::Parser::TreetopExt
|
112
121
|
end
|
113
122
|
end
|
114
|
-
end
|
123
|
+
end
|
data/lib/cucumber/rails/rspec.rb
CHANGED
@@ -2,7 +2,9 @@ require 'cucumber/rails/world'
|
|
2
2
|
require 'spec/expectations'
|
3
3
|
require 'spec/rails/matchers'
|
4
4
|
|
5
|
-
Cucumber::Rails::World.
|
6
|
-
|
7
|
-
|
5
|
+
[Cucumber::Rails::World, ActionController::Integration::Session].each do |klass|
|
6
|
+
klass.class_eval do
|
7
|
+
include Spec::Matchers
|
8
|
+
include Spec::Rails::Matchers
|
9
|
+
end
|
8
10
|
end
|