gherkin 2.12.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -15
- data/CONTRIBUTING.md +23 -0
- data/Gemfile +0 -3
- data/LICENSE +18 -17
- data/Makefile +65 -0
- data/README.md +9 -268
- data/Rakefile +17 -19
- data/bin/gherkin-generate-ast +21 -0
- data/bin/gherkin-generate-pickles +25 -0
- data/bin/gherkin-generate-tokens +12 -0
- data/gherkin-ruby.razor +218 -0
- data/gherkin.gemspec +22 -76
- data/lib/gherkin/ast_builder.rb +243 -0
- data/lib/gherkin/ast_node.rb +30 -0
- data/lib/gherkin/dialect.rb +58 -0
- data/lib/gherkin/errors.rb +45 -0
- data/lib/gherkin/gherkin-languages.json +2968 -0
- data/lib/gherkin/gherkin_line.rb +95 -0
- data/lib/gherkin/parser.rb +1910 -0
- data/lib/gherkin/pickles/compiler.rb +164 -0
- data/lib/gherkin/token.rb +18 -0
- data/lib/gherkin/token_formatter_builder.rb +39 -0
- data/lib/gherkin/token_matcher.rb +169 -0
- data/lib/gherkin/token_scanner.rb +40 -0
- data/spec/capture_warnings.rb +68 -0
- data/spec/coverage.rb +10 -0
- data/spec/gherkin/parser_spec.rb +146 -0
- metadata +60 -567
- data/.gitattributes +0 -2
- data/.mailmap +0 -2
- data/.rbenv-gemsets +0 -1
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.yardopts +0 -5
- data/History.md +0 -881
- data/build_native_gems.sh +0 -7
- data/cucumber.yml +0 -5
- data/examples/parse_and_output_json.rb +0 -19
- data/ext/gherkin_lexer_ar/extconf.rb +0 -6
- data/ext/gherkin_lexer_ar/gherkin_lexer_ar.c +0 -1432
- data/ext/gherkin_lexer_bg/extconf.rb +0 -6
- data/ext/gherkin_lexer_bg/gherkin_lexer_bg.c +0 -1655
- data/ext/gherkin_lexer_bm/extconf.rb +0 -6
- data/ext/gherkin_lexer_bm/gherkin_lexer_bm.c +0 -1516
- data/ext/gherkin_lexer_ca/extconf.rb +0 -6
- data/ext/gherkin_lexer_ca/gherkin_lexer_ca.c +0 -1581
- data/ext/gherkin_lexer_cs/extconf.rb +0 -6
- data/ext/gherkin_lexer_cs/gherkin_lexer_cs.c +0 -1515
- data/ext/gherkin_lexer_cy_gb/extconf.rb +0 -6
- data/ext/gherkin_lexer_cy_gb/gherkin_lexer_cy_gb.c +0 -1282
- data/ext/gherkin_lexer_da/extconf.rb +0 -6
- data/ext/gherkin_lexer_da/gherkin_lexer_da.c +0 -1298
- data/ext/gherkin_lexer_de/extconf.rb +0 -6
- data/ext/gherkin_lexer_de/gherkin_lexer_de.c +0 -1425
- data/ext/gherkin_lexer_el/extconf.rb +0 -6
- data/ext/gherkin_lexer_el/gherkin_lexer_el.c +0 -1919
- data/ext/gherkin_lexer_en/extconf.rb +0 -6
- data/ext/gherkin_lexer_en/gherkin_lexer_en.c +0 -1418
- data/ext/gherkin_lexer_en_au/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_au/gherkin_lexer_en_au.c +0 -1765
- data/ext/gherkin_lexer_en_lol/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c +0 -1177
- data/ext/gherkin_lexer_en_old/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_old/gherkin_lexer_en_old.c +0 -1309
- data/ext/gherkin_lexer_en_pirate/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c +0 -1471
- data/ext/gherkin_lexer_en_scouse/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_scouse/gherkin_lexer_en_scouse.c +0 -1634
- data/ext/gherkin_lexer_en_tx/extconf.rb +0 -6
- data/ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c +0 -1265
- data/ext/gherkin_lexer_eo/extconf.rb +0 -6
- data/ext/gherkin_lexer_eo/gherkin_lexer_eo.c +0 -1241
- data/ext/gherkin_lexer_es/extconf.rb +0 -6
- data/ext/gherkin_lexer_es/gherkin_lexer_es.c +0 -1399
- data/ext/gherkin_lexer_et/extconf.rb +0 -6
- data/ext/gherkin_lexer_et/gherkin_lexer_et.c +0 -1236
- data/ext/gherkin_lexer_fa/extconf.rb +0 -6
- data/ext/gherkin_lexer_fa/gherkin_lexer_fa.c +0 -1475
- data/ext/gherkin_lexer_fi/extconf.rb +0 -6
- data/ext/gherkin_lexer_fi/gherkin_lexer_fi.c +0 -1215
- data/ext/gherkin_lexer_fr/extconf.rb +0 -6
- data/ext/gherkin_lexer_fr/gherkin_lexer_fr.c +0 -1493
- data/ext/gherkin_lexer_gl/extconf.rb +0 -6
- data/ext/gherkin_lexer_gl/gherkin_lexer_gl.c +0 -1374
- data/ext/gherkin_lexer_he/extconf.rb +0 -6
- data/ext/gherkin_lexer_he/gherkin_lexer_he.c +0 -1374
- data/ext/gherkin_lexer_hi/extconf.rb +0 -6
- data/ext/gherkin_lexer_hi/gherkin_lexer_hi.c +0 -1848
- data/ext/gherkin_lexer_hr/extconf.rb +0 -6
- data/ext/gherkin_lexer_hr/gherkin_lexer_hr.c +0 -1323
- data/ext/gherkin_lexer_hu/extconf.rb +0 -6
- data/ext/gherkin_lexer_hu/gherkin_lexer_hu.c +0 -1376
- data/ext/gherkin_lexer_id/extconf.rb +0 -6
- data/ext/gherkin_lexer_id/gherkin_lexer_id.c +0 -1208
- data/ext/gherkin_lexer_is/extconf.rb +0 -6
- data/ext/gherkin_lexer_is/gherkin_lexer_is.c +0 -1376
- data/ext/gherkin_lexer_it/extconf.rb +0 -6
- data/ext/gherkin_lexer_it/gherkin_lexer_it.c +0 -1340
- data/ext/gherkin_lexer_ja/extconf.rb +0 -6
- data/ext/gherkin_lexer_ja/gherkin_lexer_ja.c +0 -1699
- data/ext/gherkin_lexer_kn/extconf.rb +0 -6
- data/ext/gherkin_lexer_kn/gherkin_lexer_kn.c +0 -1965
- data/ext/gherkin_lexer_ko/extconf.rb +0 -6
- data/ext/gherkin_lexer_ko/gherkin_lexer_ko.c +0 -1360
- data/ext/gherkin_lexer_lt/extconf.rb +0 -6
- data/ext/gherkin_lexer_lt/gherkin_lexer_lt.c +0 -1296
- data/ext/gherkin_lexer_lu/extconf.rb +0 -6
- data/ext/gherkin_lexer_lu/gherkin_lexer_lu.c +0 -1389
- data/ext/gherkin_lexer_lv/extconf.rb +0 -6
- data/ext/gherkin_lexer_lv/gherkin_lexer_lv.c +0 -1425
- data/ext/gherkin_lexer_nl/extconf.rb +0 -6
- data/ext/gherkin_lexer_nl/gherkin_lexer_nl.c +0 -1368
- data/ext/gherkin_lexer_no/extconf.rb +0 -6
- data/ext/gherkin_lexer_no/gherkin_lexer_no.c +0 -1311
- data/ext/gherkin_lexer_pa/extconf.rb +0 -6
- data/ext/gherkin_lexer_pa/gherkin_lexer_pa.c +0 -2160
- data/ext/gherkin_lexer_pl/extconf.rb +0 -6
- data/ext/gherkin_lexer_pl/gherkin_lexer_pl.c +0 -1738
- data/ext/gherkin_lexer_pt/extconf.rb +0 -6
- data/ext/gherkin_lexer_pt/gherkin_lexer_pt.c +0 -1711
- data/ext/gherkin_lexer_ro/extconf.rb +0 -6
- data/ext/gherkin_lexer_ro/gherkin_lexer_ro.c +0 -1427
- data/ext/gherkin_lexer_ru/extconf.rb +0 -6
- data/ext/gherkin_lexer_ru/gherkin_lexer_ru.c +0 -2071
- data/ext/gherkin_lexer_sk/extconf.rb +0 -6
- data/ext/gherkin_lexer_sk/gherkin_lexer_sk.c +0 -1739
- data/ext/gherkin_lexer_sr_cyrl/extconf.rb +0 -6
- data/ext/gherkin_lexer_sr_cyrl/gherkin_lexer_sr_cyrl.c +0 -2112
- data/ext/gherkin_lexer_sr_latn/extconf.rb +0 -6
- data/ext/gherkin_lexer_sr_latn/gherkin_lexer_sr_latn.c +0 -1567
- data/ext/gherkin_lexer_sv/extconf.rb +0 -6
- data/ext/gherkin_lexer_sv/gherkin_lexer_sv.c +0 -1324
- data/ext/gherkin_lexer_th/extconf.rb +0 -6
- data/ext/gherkin_lexer_th/gherkin_lexer_th.c +0 -2840
- data/ext/gherkin_lexer_tl/extconf.rb +0 -6
- data/ext/gherkin_lexer_tl/gherkin_lexer_tl.c +0 -2021
- data/ext/gherkin_lexer_tr/extconf.rb +0 -6
- data/ext/gherkin_lexer_tr/gherkin_lexer_tr.c +0 -1347
- data/ext/gherkin_lexer_tt/extconf.rb +0 -6
- data/ext/gherkin_lexer_tt/gherkin_lexer_tt.c +0 -1936
- data/ext/gherkin_lexer_uk/extconf.rb +0 -6
- data/ext/gherkin_lexer_uk/gherkin_lexer_uk.c +0 -1941
- data/ext/gherkin_lexer_uz/extconf.rb +0 -6
- data/ext/gherkin_lexer_uz/gherkin_lexer_uz.c +0 -1651
- data/ext/gherkin_lexer_vi/extconf.rb +0 -6
- data/ext/gherkin_lexer_vi/gherkin_lexer_vi.c +0 -1458
- data/ext/gherkin_lexer_zh_cn/extconf.rb +0 -6
- data/ext/gherkin_lexer_zh_cn/gherkin_lexer_zh_cn.c +0 -1314
- data/ext/gherkin_lexer_zh_tw/extconf.rb +0 -6
- data/ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c +0 -1307
- data/features/.cucumber/stepdefs.json +0 -244
- data/features/escaped_pipes.feature +0 -8
- data/features/feature_parser.feature +0 -237
- data/features/json_formatter.feature +0 -498
- data/features/json_parser.feature +0 -331
- data/features/native_lexer.feature +0 -19
- data/features/parser_with_native_lexer.feature +0 -205
- data/features/pretty_formatter.feature +0 -17
- data/features/step_definitions/eyeball_steps.rb +0 -3
- data/features/step_definitions/gherkin_steps.rb +0 -29
- data/features/step_definitions/json_formatter_steps.rb +0 -30
- data/features/step_definitions/json_parser_steps.rb +0 -21
- data/features/step_definitions/pretty_formatter_steps.rb +0 -85
- data/features/steps_parser.feature +0 -46
- data/features/support/env.rb +0 -41
- data/install_mingw_os_x.sh +0 -5
- data/js/.npmignore +0 -1
- data/js/lib/gherkin/lexer/.npmignore +0 -0
- data/lib/gherkin.rb +0 -2
- data/lib/gherkin/README.md +0 -7
- data/lib/gherkin/c_lexer.rb +0 -17
- data/lib/gherkin/formatter/ansi_escapes.rb +0 -97
- data/lib/gherkin/formatter/argument.rb +0 -16
- data/lib/gherkin/formatter/escaping.rb +0 -15
- data/lib/gherkin/formatter/filter_formatter.rb +0 -150
- data/lib/gherkin/formatter/hashable.rb +0 -25
- data/lib/gherkin/formatter/json_formatter.rb +0 -133
- data/lib/gherkin/formatter/line_filter.rb +0 -26
- data/lib/gherkin/formatter/model.rb +0 -281
- data/lib/gherkin/formatter/pretty_formatter.rb +0 -245
- data/lib/gherkin/formatter/regexp_filter.rb +0 -21
- data/lib/gherkin/formatter/step_printer.rb +0 -21
- data/lib/gherkin/formatter/tag_count_formatter.rb +0 -47
- data/lib/gherkin/formatter/tag_filter.rb +0 -19
- data/lib/gherkin/i18n.json +0 -786
- data/lib/gherkin/i18n.rb +0 -176
- data/lib/gherkin/json_parser.rb +0 -177
- data/lib/gherkin/lexer/ar.rb +0 -1170
- data/lib/gherkin/lexer/bg.rb +0 -1382
- data/lib/gherkin/lexer/bm.rb +0 -1250
- data/lib/gherkin/lexer/ca.rb +0 -1310
- data/lib/gherkin/lexer/cs.rb +0 -1246
- data/lib/gherkin/lexer/cy_gb.rb +0 -1032
- data/lib/gherkin/lexer/da.rb +0 -1048
- data/lib/gherkin/lexer/de.rb +0 -1166
- data/lib/gherkin/lexer/el.rb +0 -1628
- data/lib/gherkin/lexer/en.rb +0 -1156
- data/lib/gherkin/lexer/en_au.rb +0 -1486
- data/lib/gherkin/lexer/en_lol.rb +0 -934
- data/lib/gherkin/lexer/en_old.rb +0 -1037
- data/lib/gherkin/lexer/en_pirate.rb +0 -1210
- data/lib/gherkin/lexer/en_scouse.rb +0 -1362
- data/lib/gherkin/lexer/en_tx.rb +0 -1016
- data/lib/gherkin/lexer/encoding.rb +0 -41
- data/lib/gherkin/lexer/eo.rb +0 -995
- data/lib/gherkin/lexer/es.rb +0 -1140
- data/lib/gherkin/lexer/et.rb +0 -990
- data/lib/gherkin/lexer/fa.rb +0 -1214
- data/lib/gherkin/lexer/fi.rb +0 -969
- data/lib/gherkin/lexer/fr.rb +0 -1228
- data/lib/gherkin/lexer/gl.rb +0 -1117
- data/lib/gherkin/lexer/he.rb +0 -1118
- data/lib/gherkin/lexer/hi.rb +0 -1559
- data/lib/gherkin/lexer/hr.rb +0 -1066
- data/lib/gherkin/lexer/hu.rb +0 -1118
- data/lib/gherkin/lexer/i18n_lexer.rb +0 -48
- data/lib/gherkin/lexer/id.rb +0 -963
- data/lib/gherkin/lexer/is.rb +0 -1120
- data/lib/gherkin/lexer/it.rb +0 -1086
- data/lib/gherkin/lexer/ja.rb +0 -1418
- data/lib/gherkin/lexer/kn.rb +0 -1672
- data/lib/gherkin/lexer/ko.rb +0 -1102
- data/lib/gherkin/lexer/lt.rb +0 -1045
- data/lib/gherkin/lexer/lu.rb +0 -1132
- data/lib/gherkin/lexer/lv.rb +0 -1166
- data/lib/gherkin/lexer/nl.rb +0 -1115
- data/lib/gherkin/lexer/no.rb +0 -1060
- data/lib/gherkin/lexer/pa.rb +0 -1852
- data/lib/gherkin/lexer/pl.rb +0 -1457
- data/lib/gherkin/lexer/pt.rb +0 -1430
- data/lib/gherkin/lexer/ro.rb +0 -1164
- data/lib/gherkin/lexer/ru.rb +0 -1766
- data/lib/gherkin/lexer/sk.rb +0 -1452
- data/lib/gherkin/lexer/sr_cyrl.rb +0 -1803
- data/lib/gherkin/lexer/sr_latn.rb +0 -1294
- data/lib/gherkin/lexer/sv.rb +0 -1070
- data/lib/gherkin/lexer/th.rb +0 -2492
- data/lib/gherkin/lexer/tl.rb +0 -1726
- data/lib/gherkin/lexer/tr.rb +0 -1092
- data/lib/gherkin/lexer/tt.rb +0 -1643
- data/lib/gherkin/lexer/uk.rb +0 -1646
- data/lib/gherkin/lexer/uz.rb +0 -1376
- data/lib/gherkin/lexer/vi.rb +0 -1198
- data/lib/gherkin/lexer/zh_cn.rb +0 -1058
- data/lib/gherkin/lexer/zh_tw.rb +0 -1052
- data/lib/gherkin/listener/event.rb +0 -45
- data/lib/gherkin/listener/formatter_listener.rb +0 -150
- data/lib/gherkin/native.rb +0 -7
- data/lib/gherkin/native/java.rb +0 -72
- data/lib/gherkin/native/null.rb +0 -5
- data/lib/gherkin/native/therubyracer.rb +0 -41
- data/lib/gherkin/parser/meta.txt +0 -5
- data/lib/gherkin/parser/parser.rb +0 -166
- data/lib/gherkin/parser/root.txt +0 -11
- data/lib/gherkin/parser/steps.txt +0 -4
- data/lib/gherkin/platform.rb +0 -13
- data/lib/gherkin/rubify.rb +0 -31
- data/lib/gherkin/tag_expression.rb +0 -63
- data/ragel/lexer.c.rl.erb +0 -454
- data/ragel/lexer.java.rl.erb +0 -219
- data/ragel/lexer.js.rl.erb +0 -322
- data/ragel/lexer.rb.rl.erb +0 -179
- data/ragel/lexer_common.rl.erb +0 -50
- data/spec/gherkin/c_lexer_spec.rb +0 -22
- data/spec/gherkin/fixtures/1.feature +0 -8
- data/spec/gherkin/fixtures/comments_in_table.feature +0 -9
- data/spec/gherkin/fixtures/complex.feature +0 -45
- data/spec/gherkin/fixtures/complex.json +0 -139
- data/spec/gherkin/fixtures/complex_for_filtering.feature +0 -60
- data/spec/gherkin/fixtures/complex_with_tags.feature +0 -61
- data/spec/gherkin/fixtures/dos_line_endings.feature +0 -45
- data/spec/gherkin/fixtures/examples_with_only_header.feature +0 -14
- data/spec/gherkin/fixtures/hantu_pisang.feature +0 -35
- data/spec/gherkin/fixtures/i18n_fr.feature +0 -14
- data/spec/gherkin/fixtures/i18n_fr2.feature +0 -8
- data/spec/gherkin/fixtures/i18n_no.feature +0 -7
- data/spec/gherkin/fixtures/i18n_pt1.feature +0 -44
- data/spec/gherkin/fixtures/i18n_pt2.feature +0 -4
- data/spec/gherkin/fixtures/i18n_pt3.feature +0 -4
- data/spec/gherkin/fixtures/i18n_pt4.feature +0 -4
- data/spec/gherkin/fixtures/i18n_zh-CN.feature +0 -9
- data/spec/gherkin/fixtures/iso-8859-1.feature +0 -6
- data/spec/gherkin/fixtures/issue_145.feature +0 -22
- data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +0 -13
- data/spec/gherkin/fixtures/scenario_without_steps.feature +0 -5
- data/spec/gherkin/fixtures/simple_with_comments.feature +0 -7
- data/spec/gherkin/fixtures/simple_with_tags.feature +0 -11
- data/spec/gherkin/fixtures/with_bom.feature +0 -3
- data/spec/gherkin/fixtures/with_bom_and_language_spec.feature +0 -4
- data/spec/gherkin/formatter/ansi_escapes_spec.rb +0 -32
- data/spec/gherkin/formatter/filter_formatter_spec.rb +0 -204
- data/spec/gherkin/formatter/json_formatter_spec.rb +0 -179
- data/spec/gherkin/formatter/model_spec.rb +0 -28
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +0 -184
- data/spec/gherkin/formatter/spaces.feature +0 -9
- data/spec/gherkin/formatter/step_printer_spec.rb +0 -55
- data/spec/gherkin/formatter/tabs.feature +0 -9
- data/spec/gherkin/formatter/tag_count_formatter_spec.rb +0 -30
- data/spec/gherkin/i18n_spec.rb +0 -256
- data/spec/gherkin/java_lexer_spec.rb +0 -20
- data/spec/gherkin/json_parser_spec.rb +0 -165
- data/spec/gherkin/lexer/i18n_lexer_spec.rb +0 -65
- data/spec/gherkin/native_lexer_spec.rb +0 -29
- data/spec/gherkin/parser/parser_spec.rb +0 -16
- data/spec/gherkin/rubify_spec.rb +0 -23
- data/spec/gherkin/sexp_recorder.rb +0 -59
- data/spec/gherkin/shared/doc_string_group.rb +0 -161
- data/spec/gherkin/shared/encoding_group.rb +0 -48
- data/spec/gherkin/shared/lexer_group.rb +0 -589
- data/spec/gherkin/shared/row_group.rb +0 -123
- data/spec/gherkin/shared/tags_group.rb +0 -52
- data/spec/gherkin/tag_expression_spec.rb +0 -146
- data/spec/spec_helper.rb +0 -94
- data/tasks/apidoc.rake +0 -32
- data/tasks/bench.rake +0 -184
- data/tasks/bench/feature_builder.rb +0 -49
- data/tasks/bench/null_listener.rb +0 -4
- data/tasks/compile.rake +0 -83
- data/tasks/cucumber.rake +0 -23
- data/tasks/gems.rake +0 -46
- data/tasks/ikvm.rake +0 -126
- data/tasks/ragel_task.rb +0 -124
- data/tasks/release.rake +0 -34
- data/tasks/rspec.rake +0 -6
- data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
- data/tasks/yard/default/layout/html/footer.erb +0 -5
- data/tasks/yard/default/layout/html/index.erb +0 -1
- data/tasks/yard/default/layout/html/layout.erb +0 -25
- data/tasks/yard/default/layout/html/logo.erb +0 -1
- data/tasks/yard/default/layout/html/setup.rb +0 -4
@@ -1,17 +0,0 @@
|
|
1
|
-
@cucumber-source-available
|
2
|
-
Feature: Pretty Formatter
|
3
|
-
In order to have pretty gherkin
|
4
|
-
I want to verify that all prettified cucumber features parse OK
|
5
|
-
|
6
|
-
Scenario: Parse all the features in Cucumber
|
7
|
-
Given I have Cucumber's source code next to Gherkin's
|
8
|
-
And I find all of the .feature files
|
9
|
-
When I send each prettified original through the "pretty" machinery
|
10
|
-
Then the machinery output should be identical to the prettified original
|
11
|
-
|
12
|
-
@no-javascript
|
13
|
-
Scenario: Parse all the features in Cucumber with JSON
|
14
|
-
Given I have Cucumber's source code next to Gherkin's
|
15
|
-
And I find all of the .feature files
|
16
|
-
When I send each prettified original through the "json" machinery
|
17
|
-
Then the machinery output should be identical to the prettified original
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Given /^a "(ruby|native)" "([^\"]*)" parser$/ do |ruby_or_native, parser_name|
|
2
|
-
@parser = Gherkin::Parser::Parser.new(@formatter, false, parser_name, ruby_or_native=="ruby")
|
3
|
-
end
|
4
|
-
|
5
|
-
Given "the following text is parsed:" do |text|
|
6
|
-
@parser.parse(text, "test.feature", 0)
|
7
|
-
end
|
8
|
-
|
9
|
-
Then "there should be no parse errors" do
|
10
|
-
@formatter.errors.should == []
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^there should be a parse error on (line \d+)$/ do |line|
|
14
|
-
@formatter.line(line).should include(:syntax_error, line)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^there should be parse errors on (lines .*)$/ do |lines|
|
18
|
-
lines.each do |line|
|
19
|
-
step "there should be a parse error on line #{line}"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Transform /^line \d+$/ do |step_arg|
|
24
|
-
tr_line_number(step_arg)
|
25
|
-
end
|
26
|
-
|
27
|
-
Transform /^lines .*$/ do |step_arg|
|
28
|
-
tr_line_numbers(step_arg)
|
29
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'stringio'
|
2
|
-
require 'gherkin/formatter/json_formatter'
|
3
|
-
require 'gherkin/listener/formatter_listener'
|
4
|
-
|
5
|
-
# Monkey patching so that Hash.to_json has a predictable result.
|
6
|
-
class Hash
|
7
|
-
alias orig_keys keys
|
8
|
-
def keys
|
9
|
-
orig_keys.sort
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Given /^a JSON formatter$/ do
|
14
|
-
@out = StringIO.new
|
15
|
-
@formatter = Gherkin::Formatter::JSONFormatter.new(@out)
|
16
|
-
end
|
17
|
-
|
18
|
-
Then /^the outputted JSON should be:$/ do |expected_json|
|
19
|
-
require 'multi_json'
|
20
|
-
@formatter.done
|
21
|
-
actual_json = @out.string
|
22
|
-
puts actual_json
|
23
|
-
puts MultiJson.dump(MultiJson.load(actual_json), :pretty => true)
|
24
|
-
expected = MultiJson.load(expected_json)
|
25
|
-
actual = MultiJson.load(actual_json)
|
26
|
-
actual.should == expected
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'stringio'
|
2
|
-
require 'gherkin/formatter/pretty_formatter'
|
3
|
-
require 'gherkin/json_parser'
|
4
|
-
require 'multi_json'
|
5
|
-
|
6
|
-
Given /^a PrettyFormatter$/ do
|
7
|
-
@io = StringIO.new
|
8
|
-
@formatter = Gherkin::Formatter::PrettyFormatter.new(@io, true, false)
|
9
|
-
end
|
10
|
-
|
11
|
-
Given /^a JSON lexer$/ do
|
12
|
-
@json_parser = Gherkin::JSONParser.new(@formatter, @formatter)
|
13
|
-
end
|
14
|
-
|
15
|
-
Given /^the following JSON is parsed:$/ do |text|
|
16
|
-
@json_parser.parse(MultiJson.dump(MultiJson.load(text), :pretty => true))
|
17
|
-
end
|
18
|
-
|
19
|
-
Then /^the outputted text should be:$/ do |expected_text|
|
20
|
-
@io.string.strip.should == expected_text
|
21
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'stringio'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'gherkin'
|
4
|
-
require 'gherkin/formatter/pretty_formatter'
|
5
|
-
require 'gherkin/formatter/json_formatter'
|
6
|
-
require 'gherkin/json_parser'
|
7
|
-
|
8
|
-
module PrettyPlease
|
9
|
-
|
10
|
-
def pretty_machinery(gherkin, feature_path)
|
11
|
-
io = StringIO.new
|
12
|
-
formatter = Gherkin::Formatter::PrettyFormatter.new(io, true, false)
|
13
|
-
parser = Gherkin::Parser::Parser.new(formatter, true)
|
14
|
-
parse(parser, gherkin, feature_path)
|
15
|
-
io.string
|
16
|
-
end
|
17
|
-
|
18
|
-
def json_machinery(gherkin, feature_path)
|
19
|
-
json = StringIO.new
|
20
|
-
json_formatter = Gherkin::Formatter::JSONFormatter.new(json)
|
21
|
-
gherkin_parser = Gherkin::Parser::Parser.new(json_formatter, true)
|
22
|
-
parse(gherkin_parser, gherkin, feature_path)
|
23
|
-
json_formatter.done
|
24
|
-
|
25
|
-
io = StringIO.new
|
26
|
-
pretty_formatter = Gherkin::Formatter::PrettyFormatter.new(io, true, false)
|
27
|
-
json_parser = Gherkin::JSONParser.new(pretty_formatter, pretty_formatter)
|
28
|
-
json_parser.parse(json.string)
|
29
|
-
|
30
|
-
io.string
|
31
|
-
end
|
32
|
-
|
33
|
-
def parse(parser, gherkin, feature_path)
|
34
|
-
begin
|
35
|
-
parser.parse(gherkin, feature_path, 0)
|
36
|
-
rescue => e
|
37
|
-
if e.message =~ /Lexing error/
|
38
|
-
FileUtils.mkdir "tmp" unless File.directory?("tmp")
|
39
|
-
written_path = "tmp/#{File.basename(feature_path)}"
|
40
|
-
File.open(written_path, "w") {|io| io.write(gherkin)}
|
41
|
-
e.message << "\nSee #{written_path}"
|
42
|
-
end
|
43
|
-
raise e
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
World(PrettyPlease)
|
49
|
-
|
50
|
-
Given /^I have Cucumber's source code next to Gherkin's$/ do
|
51
|
-
@cucumber_home = File.dirname(__FILE__) + '/../../../cucumber'
|
52
|
-
raise "No Cucumber source in #{@cucumber_home}" unless File.file?(@cucumber_home + '/bin/cucumber')
|
53
|
-
end
|
54
|
-
|
55
|
-
Given /^I find all of the \.feature files$/ do
|
56
|
-
@feature_paths = Dir["#{@cucumber_home}/**/*.feature"].sort
|
57
|
-
end
|
58
|
-
|
59
|
-
When /^I send each prettified original through the "([^"]*)" machinery$/ do |machinery|
|
60
|
-
@error = false
|
61
|
-
@feature_paths.each do |feature_path|
|
62
|
-
begin
|
63
|
-
next if feature_path =~ /iso-8859-1\.feature/
|
64
|
-
original = pretty_machinery(IO.read(feature_path), feature_path)
|
65
|
-
via_machinery = self.__send__("#{machinery}_machinery", original, feature_path)
|
66
|
-
via_machinery.should == original
|
67
|
-
rescue RSpec::Expectations::ExpectationNotMetError => e
|
68
|
-
announce "=========="
|
69
|
-
announce feature_path
|
70
|
-
if(e.message =~ /(@@.*)/m)
|
71
|
-
announce $1
|
72
|
-
@error = true
|
73
|
-
else
|
74
|
-
announce "Identical, except for newlines"
|
75
|
-
end
|
76
|
-
rescue => e
|
77
|
-
e.message << "\nFatal error happened when parsing #{feature_path}."
|
78
|
-
raise e
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
Then /^the machinery output should be identical to the prettified original$/ do
|
84
|
-
raise "Some features didn't make it through the machinery" if @error
|
85
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Feature: Gherkin Steps parser
|
2
|
-
In order to save time and make my features clearer
|
3
|
-
As a Cucumber developer
|
4
|
-
I want a steps parser to make writing compound steps easier
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a "ruby" "steps" parser
|
8
|
-
|
9
|
-
Scenario: Parsing steps
|
10
|
-
Given the following text is parsed:
|
11
|
-
"""
|
12
|
-
Given a one step
|
13
|
-
And a two step
|
14
|
-
\"\"\"
|
15
|
-
Here is a multiline string
|
16
|
-
That follows a step
|
17
|
-
With an argument #{arg}
|
18
|
-
\"\"\"
|
19
|
-
And a one two three step
|
20
|
-
When another step
|
21
|
-
Then there should be a table
|
22
|
-
| one | two | three |
|
23
|
-
| foo | bar | #{arg} |
|
24
|
-
"""
|
25
|
-
Then there should be no parse errors
|
26
|
-
|
27
|
-
Scenario: Trying to parse a full feature with the step parser
|
28
|
-
Given the following text is parsed:
|
29
|
-
"""
|
30
|
-
Feature: A Feature
|
31
|
-
Scenario: Yes, there is one
|
32
|
-
Given I have a step
|
33
|
-
When I execute this step
|
34
|
-
Then something should happen
|
35
|
-
"""
|
36
|
-
Then there should be parse errors on lines 1 and 2
|
37
|
-
|
38
|
-
Scenario: Tags
|
39
|
-
Given the following text is parsed:
|
40
|
-
"""
|
41
|
-
@a_tag
|
42
|
-
Given a step
|
43
|
-
When I trip
|
44
|
-
Then I should sign up for dancing lessons
|
45
|
-
"""
|
46
|
-
Then there should be a parse error on line 1
|
data/features/support/env.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
if RUBY_VERSION =~ /1.9/
|
2
|
-
Encoding.default_external = Encoding::UTF_8
|
3
|
-
Encoding.default_internal = Encoding::UTF_8
|
4
|
-
end
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup
|
9
|
-
|
10
|
-
# I'm sure there's a better way than this...
|
11
|
-
%w{ /../../spec /../../lib}.each do |path|
|
12
|
-
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + path)
|
13
|
-
end
|
14
|
-
require 'gherkin'
|
15
|
-
require 'gherkin/sexp_recorder'
|
16
|
-
|
17
|
-
module TransformHelpers
|
18
|
-
def tr_line_number(step_arg)
|
19
|
-
/(\d+)$/.match(step_arg)[0].to_i
|
20
|
-
end
|
21
|
-
|
22
|
-
def tr_line_numbers(step_arg)
|
23
|
-
if step_arg =~ /through/
|
24
|
-
Range.new(*step_arg.scan(/\d+/).collect { |i| i.to_i })
|
25
|
-
else
|
26
|
-
step_arg.scan(/\d+/).collect { |i| i.to_i }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class GherkinWorld
|
32
|
-
include TransformHelpers
|
33
|
-
|
34
|
-
def initialize
|
35
|
-
@formatter = Gherkin::SexpRecorder.new
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
World do
|
40
|
-
GherkinWorld.new
|
41
|
-
end
|
data/install_mingw_os_x.sh
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
mkdir -p /usr/local/mingw
|
3
|
-
|
4
|
-
# We need GCC 4.7 in order to build ruby 1.8.7. When we drop support for that we can use a more recent one
|
5
|
-
cd /usr/local/mingw && curl --silent --location http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Automated%20Builds/mingw-w32-1.0-bin_i686-darwin_20120227.tar.bz2 | tar xvj
|
data/js/.npmignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
example
|
File without changes
|
data/lib/gherkin.rb
DELETED
data/lib/gherkin/README.md
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
The i18n.json file uses [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and [ISO 3166 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1) (region - if applicable):
|
2
|
-
|
3
|
-
If you want several aliases for a keyword, just separate them
|
4
|
-
with a `|` character. The `*` is a step keyword alias for all translations.
|
5
|
-
|
6
|
-
If you do *not* want a trailing space after a keyword, end it with a `<` character.
|
7
|
-
(See Chinese for examples).
|
data/lib/gherkin/c_lexer.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
module Gherkin
|
4
|
-
module CLexer
|
5
|
-
def self.[](i18n_underscored_iso_code)
|
6
|
-
begin
|
7
|
-
prefix = RbConfig::CONFIG['arch'] =~ /mswin|mingw/ ? "#{RbConfig::CONFIG['MAJOR']}.#{RbConfig::CONFIG['MINOR']}/" : ''
|
8
|
-
lib = "#{prefix}gherkin_lexer_#{i18n_underscored_iso_code}"
|
9
|
-
require lib
|
10
|
-
const_get(i18n_underscored_iso_code.capitalize)
|
11
|
-
rescue LoadError => e
|
12
|
-
e.message << %{\nCouldn't load #{lib}\nThe $LOAD_PATH was:\n#{$LOAD_PATH.join("\n")}}
|
13
|
-
raise e
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
module Gherkin
|
2
|
-
module Formatter
|
3
|
-
# Defines aliases for ANSI coloured output. Default colours can be overridden by defining
|
4
|
-
# a <tt>GHERKIN_COLORS</tt> variable in your shell, very much like how you can
|
5
|
-
# tweak the familiar POSIX command <tt>ls</tt> with
|
6
|
-
# $LSCOLORS: http://linux-sxs.org/housekeeping/lscolors.html
|
7
|
-
#
|
8
|
-
# The colours that you can change are:
|
9
|
-
#
|
10
|
-
# <tt>undefined</tt>:: defaults to <tt>yellow</tt>
|
11
|
-
# <tt>pending</tt>:: defaults to <tt>yellow</tt>
|
12
|
-
# <tt>pending_arg</tt>:: defaults to <tt>yellow,bold</tt>
|
13
|
-
# <tt>executing</tt>:: defaults to <tt>grey</tt>
|
14
|
-
# <tt>executing_arg</tt>:: defaults to <tt>grey,bold</tt>
|
15
|
-
# <tt>failed</tt>:: defaults to <tt>red</tt>
|
16
|
-
# <tt>failed_arg</tt>:: defaults to <tt>red,bold</tt>
|
17
|
-
# <tt>passed</tt>:: defaults to <tt>green</tt>
|
18
|
-
# <tt>passed_arg</tt>:: defaults to <tt>green,bold</tt>
|
19
|
-
# <tt>outline</tt>:: defaults to <tt>cyan</tt>
|
20
|
-
# <tt>outline_arg</tt>:: defaults to <tt>cyan,bold</tt>
|
21
|
-
# <tt>skipped</tt>:: defaults to <tt>cyan</tt>
|
22
|
-
# <tt>skipped_arg</tt>:: defaults to <tt>cyan,bold</tt>
|
23
|
-
# <tt>comment</tt>:: defaults to <tt>grey</tt>
|
24
|
-
# <tt>tag</tt>:: defaults to <tt>cyan</tt>
|
25
|
-
#
|
26
|
-
# For instance, if your shell has a black background and a green font (like the
|
27
|
-
# "Homebrew" settings for OS X' Terminal.app), you may want to override passed
|
28
|
-
# steps to be white instead of green. Examples:
|
29
|
-
#
|
30
|
-
# export GHERKIN_COLORS="passed=white"
|
31
|
-
# export GHERKIN_COLORS="passed=white,bold:passed_arg=white,bold,underline"
|
32
|
-
#
|
33
|
-
# (If you're on Windows, use SET instead of export).
|
34
|
-
# To see what colours and effects are available, just run this in your shell:
|
35
|
-
#
|
36
|
-
# ruby -e "require 'rubygems'; require 'term/ansicolor'; puts Term::ANSIColor.attributes"
|
37
|
-
#
|
38
|
-
# Although not listed, you can also use <tt>grey</tt>
|
39
|
-
module AnsiEscapes
|
40
|
-
COLORS = {
|
41
|
-
'black' => "\e[30m",
|
42
|
-
'red' => "\e[31m",
|
43
|
-
'green' => "\e[32m",
|
44
|
-
'yellow' => "\e[33m",
|
45
|
-
'blue' => "\e[34m",
|
46
|
-
'magenta' => "\e[35m",
|
47
|
-
'cyan' => "\e[36m",
|
48
|
-
'white' => "\e[37m",
|
49
|
-
'grey' => "\e[90m",
|
50
|
-
'bold' => "\e[1m"
|
51
|
-
}
|
52
|
-
|
53
|
-
ALIASES = Hash.new do |h,k|
|
54
|
-
if k.to_s =~ /(.*)_arg/
|
55
|
-
h[$1] + ',bold'
|
56
|
-
end
|
57
|
-
end.merge({
|
58
|
-
'undefined' => 'yellow',
|
59
|
-
'pending' => 'yellow',
|
60
|
-
'executing' => 'grey',
|
61
|
-
'failed' => 'red',
|
62
|
-
'passed' => 'green',
|
63
|
-
'outline' => 'cyan',
|
64
|
-
'skipped' => 'cyan',
|
65
|
-
'comments' => 'grey',
|
66
|
-
'tag' => 'cyan'
|
67
|
-
})
|
68
|
-
|
69
|
-
if ENV['GHERKIN_COLORS'] # Example: export GHERKIN_COLORS="passed=red:failed=yellow"
|
70
|
-
ENV['GHERKIN_COLORS'].split(':').each do |pair|
|
71
|
-
a = pair.split('=')
|
72
|
-
ALIASES[a[0]] = a[1]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
ALIASES.keys.each do |key|
|
77
|
-
define_method(key) do
|
78
|
-
ALIASES[key].split(',').map{|color| COLORS[color]}.join('')
|
79
|
-
end
|
80
|
-
|
81
|
-
define_method("#{key}_arg") do
|
82
|
-
ALIASES["#{key}_arg"].split(',').map{|color| COLORS[color]}.join('')
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def reset
|
87
|
-
"\e[0m"
|
88
|
-
end
|
89
|
-
|
90
|
-
def up(n)
|
91
|
-
"\e[#{n}A"
|
92
|
-
end
|
93
|
-
|
94
|
-
extend self
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'gherkin/native'
|
2
|
-
require 'gherkin/formatter/hashable'
|
3
|
-
|
4
|
-
module Gherkin
|
5
|
-
module Formatter
|
6
|
-
class Argument < Hashable
|
7
|
-
native_impl('gherkin')
|
8
|
-
attr_reader :offset, :val
|
9
|
-
|
10
|
-
# Creates a new Argument that starts at character offset +offset+ with value +val+
|
11
|
-
def initialize(offset, val)
|
12
|
-
@offset, @val = offset, val
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Gherkin
|
2
|
-
module Formatter
|
3
|
-
module Escaping
|
4
|
-
# Escapes a pipes and backslashes:
|
5
|
-
#
|
6
|
-
# * | becomes \|
|
7
|
-
# * \ becomes \\
|
8
|
-
#
|
9
|
-
# This is used in the pretty formatter.
|
10
|
-
def escape_cell(s)
|
11
|
-
s.gsub(/\\(?!\|)/, "\\\\\\\\").gsub(/\n/, "\\n").gsub(/\|/, "\\|")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|