bryanl-gherkin 2.11.1.1-java

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.
Files changed (142) hide show
  1. data/.gitattributes +2 -0
  2. data/.mailmap +2 -0
  3. data/.rbenv-gemsets +1 -0
  4. data/.rspec +1 -0
  5. data/.rvmrc +1 -0
  6. data/.travis.yml +16 -0
  7. data/.yardopts +5 -0
  8. data/Gemfile +5 -0
  9. data/History.md +788 -0
  10. data/LICENSE +20 -0
  11. data/README.md +272 -0
  12. data/Rakefile +26 -0
  13. data/build_native_gems.sh +7 -0
  14. data/cucumber.yml +4 -0
  15. data/examples/parse_and_output_json.rb +19 -0
  16. data/features/.cucumber/stepdefs.json +244 -0
  17. data/features/escaped_pipes.feature +8 -0
  18. data/features/feature_parser.feature +237 -0
  19. data/features/json_formatter.feature +498 -0
  20. data/features/json_parser.feature +331 -0
  21. data/features/native_lexer.feature +19 -0
  22. data/features/parser_with_native_lexer.feature +205 -0
  23. data/features/pretty_formatter.feature +16 -0
  24. data/features/step_definitions/eyeball_steps.rb +3 -0
  25. data/features/step_definitions/gherkin_steps.rb +29 -0
  26. data/features/step_definitions/json_formatter_steps.rb +30 -0
  27. data/features/step_definitions/json_parser_steps.rb +20 -0
  28. data/features/step_definitions/pretty_formatter_steps.rb +85 -0
  29. data/features/steps_parser.feature +46 -0
  30. data/features/support/env.rb +42 -0
  31. data/gherkin.gemspec +77 -0
  32. data/install_mingw_os_x.sh +7 -0
  33. data/js/.npmignore +1 -0
  34. data/js/lib/gherkin/lexer/.npmignore +0 -0
  35. data/lib/gherkin/c_lexer.rb +17 -0
  36. data/lib/gherkin/formatter/ansi_escapes.rb +97 -0
  37. data/lib/gherkin/formatter/argument.rb +16 -0
  38. data/lib/gherkin/formatter/escaping.rb +15 -0
  39. data/lib/gherkin/formatter/filter_formatter.rb +146 -0
  40. data/lib/gherkin/formatter/hashable.rb +19 -0
  41. data/lib/gherkin/formatter/json_formatter.rb +122 -0
  42. data/lib/gherkin/formatter/line_filter.rb +26 -0
  43. data/lib/gherkin/formatter/model.rb +281 -0
  44. data/lib/gherkin/formatter/pretty_formatter.rb +244 -0
  45. data/lib/gherkin/formatter/regexp_filter.rb +21 -0
  46. data/lib/gherkin/formatter/step_printer.rb +21 -0
  47. data/lib/gherkin/formatter/tag_count_formatter.rb +47 -0
  48. data/lib/gherkin/formatter/tag_filter.rb +19 -0
  49. data/lib/gherkin/i18n.rb +180 -0
  50. data/lib/gherkin/i18n.yml +613 -0
  51. data/lib/gherkin/js_lexer.rb +20 -0
  52. data/lib/gherkin/json_parser.rb +177 -0
  53. data/lib/gherkin/lexer/i18n_lexer.rb +46 -0
  54. data/lib/gherkin/listener/event.rb +45 -0
  55. data/lib/gherkin/listener/formatter_listener.rb +143 -0
  56. data/lib/gherkin/native/java.rb +72 -0
  57. data/lib/gherkin/native/null.rb +5 -0
  58. data/lib/gherkin/native/therubyracer.rb +39 -0
  59. data/lib/gherkin/native.rb +7 -0
  60. data/lib/gherkin/parser/meta.txt +5 -0
  61. data/lib/gherkin/parser/parser.rb +164 -0
  62. data/lib/gherkin/parser/root.txt +11 -0
  63. data/lib/gherkin/parser/steps.txt +4 -0
  64. data/lib/gherkin/rb_lexer/README.rdoc +8 -0
  65. data/lib/gherkin/rb_lexer.rb +8 -0
  66. data/lib/gherkin/rubify.rb +24 -0
  67. data/lib/gherkin/tag_expression.rb +62 -0
  68. data/lib/gherkin.jar +0 -0
  69. data/lib/gherkin.rb +2 -0
  70. data/ragel/lexer.c.rl.erb +454 -0
  71. data/ragel/lexer.java.rl.erb +219 -0
  72. data/ragel/lexer.js.rl.erb +227 -0
  73. data/ragel/lexer.rb.rl.erb +174 -0
  74. data/ragel/lexer_common.rl.erb +50 -0
  75. data/spec/gherkin/c_lexer_spec.rb +22 -0
  76. data/spec/gherkin/fixtures/1.feature +8 -0
  77. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  78. data/spec/gherkin/fixtures/complex.feature +45 -0
  79. data/spec/gherkin/fixtures/complex.json +139 -0
  80. data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
  81. data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
  82. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  83. data/spec/gherkin/fixtures/examples_with_only_header.feature +14 -0
  84. data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
  85. data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
  86. data/spec/gherkin/fixtures/i18n_fr2.feature +8 -0
  87. data/spec/gherkin/fixtures/i18n_no.feature +7 -0
  88. data/spec/gherkin/fixtures/i18n_pt1.feature +44 -0
  89. data/spec/gherkin/fixtures/i18n_pt2.feature +4 -0
  90. data/spec/gherkin/fixtures/i18n_pt3.feature +4 -0
  91. data/spec/gherkin/fixtures/i18n_pt4.feature +4 -0
  92. data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
  93. data/spec/gherkin/fixtures/issue_145.feature +22 -0
  94. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
  95. data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
  96. data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
  97. data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
  98. data/spec/gherkin/fixtures/with_bom.feature +3 -0
  99. data/spec/gherkin/formatter/ansi_escapes_spec.rb +32 -0
  100. data/spec/gherkin/formatter/filter_formatter_spec.rb +204 -0
  101. data/spec/gherkin/formatter/json_formatter_spec.rb +92 -0
  102. data/spec/gherkin/formatter/model_spec.rb +28 -0
  103. data/spec/gherkin/formatter/pretty_formatter_spec.rb +177 -0
  104. data/spec/gherkin/formatter/spaces.feature +9 -0
  105. data/spec/gherkin/formatter/step_printer_spec.rb +55 -0
  106. data/spec/gherkin/formatter/tabs.feature +9 -0
  107. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
  108. data/spec/gherkin/i18n_spec.rb +241 -0
  109. data/spec/gherkin/java_lexer_spec.rb +20 -0
  110. data/spec/gherkin/js_lexer_spec.rb +23 -0
  111. data/spec/gherkin/json_parser_spec.rb +176 -0
  112. data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
  113. data/spec/gherkin/output_stream_string_io.rb +20 -0
  114. data/spec/gherkin/parser/parser_spec.rb +16 -0
  115. data/spec/gherkin/rb_lexer_spec.rb +20 -0
  116. data/spec/gherkin/sexp_recorder.rb +59 -0
  117. data/spec/gherkin/shared/bom_group.rb +20 -0
  118. data/spec/gherkin/shared/doc_string_group.rb +163 -0
  119. data/spec/gherkin/shared/lexer_group.rb +591 -0
  120. data/spec/gherkin/shared/row_group.rb +125 -0
  121. data/spec/gherkin/shared/tags_group.rb +54 -0
  122. data/spec/gherkin/tag_expression_spec.rb +142 -0
  123. data/spec/spec_helper.rb +75 -0
  124. data/tasks/bench/feature_builder.rb +49 -0
  125. data/tasks/bench/null_listener.rb +4 -0
  126. data/tasks/bench.rake +184 -0
  127. data/tasks/compile.rake +120 -0
  128. data/tasks/cucumber.rake +22 -0
  129. data/tasks/gems.rake +31 -0
  130. data/tasks/ikvm.rake +124 -0
  131. data/tasks/ragel_task.rb +100 -0
  132. data/tasks/release.rake +49 -0
  133. data/tasks/rspec.rake +8 -0
  134. data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  135. data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
  136. data/tasks/yard/default/layout/html/footer.erb +5 -0
  137. data/tasks/yard/default/layout/html/index.erb +1 -0
  138. data/tasks/yard/default/layout/html/layout.erb +25 -0
  139. data/tasks/yard/default/layout/html/logo.erb +1 -0
  140. data/tasks/yard/default/layout/html/setup.rb +4 -0
  141. data/tasks/yard.rake +7 -0
  142. metadata +412 -0
@@ -0,0 +1,163 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Gherkin
5
+ module Lexer
6
+ shared_examples_for "a Gherkin lexer lexing doc_strings" do
7
+ def scan(gherkin)
8
+ @lexer.scan(gherkin)
9
+ end
10
+
11
+ def ps(content)
12
+ '"""%s"""' % ("\n" + content + "\n")
13
+ end
14
+
15
+ it "should provide the amount of indentation of the triple quotes to the listener" do
16
+ str = <<EOS
17
+ Feature: some feature
18
+ Scenario: some scenario
19
+ Given foo
20
+ """
21
+ Hello
22
+ Goodbye
23
+ """
24
+ Then bar
25
+ EOS
26
+ @listener.should_receive(:doc_string).with('', " Hello\nGoodbye", 4)
27
+ scan(str)
28
+ end
29
+
30
+ it "should parse a simple doc_string" do
31
+ @listener.should_receive(:doc_string).with('', "I am a doc_string", 1)
32
+ scan ps("I am a doc_string")
33
+ end
34
+
35
+ it "should parse an empty doc_string" do
36
+ @listener.should_receive(:doc_string).with('', '', 4)
37
+ scan("Feature: Hi\nScenario: Hi\nGiven a step\n\"\"\"\n\"\"\"")
38
+ end
39
+
40
+ it "should treat a string containing only newlines as only newlines" do
41
+ doc_string = <<EOS
42
+ """
43
+
44
+
45
+
46
+ """
47
+ EOS
48
+ @listener.should_receive(:doc_string).with('', "\n\n", 1)
49
+ scan(doc_string)
50
+ end
51
+
52
+ it "should parse content separated by two newlines" do
53
+ scan ps("A\n\nB")
54
+ @listener.to_sexp.should == [
55
+ [:doc_string, '', "A\n\nB", 1],
56
+ [:eof]
57
+ ]
58
+ end
59
+
60
+ it "should parse a multiline string" do
61
+ @listener.should_receive(:doc_string).with('', "A\nB\nC\nD", 1)
62
+ scan ps("A\nB\nC\nD")
63
+ end
64
+
65
+ it "should ignore unescaped quotes inside the string delimeters" do
66
+ @listener.should_receive(:doc_string).with('', "What does \"this\" mean?", 1)
67
+ scan ps('What does "this" mean?')
68
+ end
69
+
70
+ it "should preserve whitespace within the triple quotes" do
71
+ str = <<EOS
72
+ """
73
+ Line one
74
+ Line two
75
+ """
76
+ EOS
77
+ @listener.should_receive(:doc_string).with('', " Line one\nLine two", 1)
78
+ scan(str)
79
+ end
80
+
81
+ it "should preserve tabs within the content" do
82
+ @listener.should_receive(:doc_string).with('', "I have\tsome tabs\nInside\t\tthe content", 1)
83
+ scan ps("I have\tsome tabs\nInside\t\tthe content")
84
+ end
85
+
86
+ it "should handle complex doc_strings" do
87
+ doc_string = <<EOS
88
+ # Feature comment
89
+ @one
90
+ Feature: Sample
91
+
92
+ @two @three
93
+ Scenario: Missing
94
+ Given missing
95
+
96
+ 1 scenario (1 passed)
97
+ 1 step (1 passed)
98
+
99
+ EOS
100
+
101
+ @listener.should_receive(:doc_string).with('', doc_string, 1)
102
+ scan ps(doc_string)
103
+ end
104
+
105
+ it "should allow whitespace after the closing doc_string delimiter" do
106
+ str = <<EOS
107
+ """
108
+ Line one
109
+ """
110
+ EOS
111
+ @listener.should_receive(:doc_string).with('', " Line one", 1)
112
+ scan(str)
113
+ end
114
+
115
+ it "should preserve the last newline(s) at the end of a doc_string" do
116
+ str = <<EOS
117
+ """
118
+ DocString text
119
+
120
+
121
+ """
122
+ EOS
123
+ @listener.should_receive(:doc_string).with('', "DocString text\n\n", 1)
124
+ scan(str)
125
+ end
126
+
127
+ it "should preserve CRLFs within doc_strings" do
128
+ @listener.should_receive(:doc_string).with('', "Line one\r\nLine two\r\n", 1)
129
+ scan("\"\"\"\r\nLine one\r\nLine two\r\n\r\n\"\"\"")
130
+ end
131
+
132
+ it "should unescape escaped triple quotes" do
133
+ str = <<EOS
134
+ """
135
+ \\"\\"\\"
136
+ """
137
+ EOS
138
+ @listener.should_receive(:doc_string).with('', '"""', 1)
139
+ scan(str)
140
+ end
141
+
142
+ it "should not unescape escaped single quotes" do
143
+ str = <<EOS
144
+ """
145
+ \\" \\"\\"
146
+ """
147
+ EOS
148
+ @listener.should_receive(:doc_string).with('', '\" \"\"', 1)
149
+ scan(str)
150
+ end
151
+
152
+ it "should lex doc_string content_types" do
153
+ str = <<EOS
154
+ """gherkin type
155
+ Feature: Doc String Types
156
+ """
157
+ EOS
158
+ @listener.should_receive(:doc_string).with('gherkin type', 'Feature: Doc String Types', 1)
159
+ scan(str)
160
+ end
161
+ end
162
+ end
163
+ end