gherkin 1.0.2-java → 1.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.gitattributes +1 -0
  2. data/History.txt +18 -0
  3. data/README.rdoc +4 -1
  4. data/Rakefile +4 -2
  5. data/VERSION.yml +1 -1
  6. data/bin/gherkin +1 -1
  7. data/dotnet/.gitignore +13 -0
  8. data/features/feature_parser.feature +22 -2
  9. data/features/native_lexer.feature +1 -1
  10. data/features/parser_with_native_lexer.feature +1 -1
  11. data/features/step_definitions/gherkin_steps.rb +2 -6
  12. data/features/step_definitions/pretty_printer_steps.rb +2 -3
  13. data/features/steps_parser.feature +1 -1
  14. data/gherkin.gemspec +40 -13
  15. data/java/Gherkin.iml +2 -4
  16. data/java/build.xml +3 -0
  17. data/java/src/gherkin/FixJava.java +6 -3
  18. data/java/src/gherkin/I18nLexer.java +48 -0
  19. data/java/src/gherkin/Listener.java +3 -1
  20. data/java/src/gherkin/Main.java +17 -0
  21. data/java/src/gherkin/Parser.java +9 -3
  22. data/java/src/gherkin/formatter/Argument.java +39 -0
  23. data/java/src/gherkin/formatter/ArgumentFormat.java +17 -0
  24. data/java/src/gherkin/formatter/Colors.java +7 -0
  25. data/java/src/gherkin/formatter/Formatter.java +15 -0
  26. data/java/src/gherkin/formatter/PrettyFormatter.java +219 -0
  27. data/java/src/gherkin/parser/StateMachineReader.java +8 -3
  28. data/java/test/gherkin/formatter/ArgumentTest.java +17 -0
  29. data/lib/gherkin/csharp_lexer.rb +15 -0
  30. data/lib/gherkin/format/argument.rb +35 -0
  31. data/lib/gherkin/format/monochrome_format.rb +9 -0
  32. data/lib/gherkin/i18n.rb +22 -0
  33. data/lib/gherkin/i18n.yml +34 -20
  34. data/lib/gherkin/i18n_lexer.rb +57 -13
  35. data/lib/gherkin/lexer.rb +9 -18
  36. data/lib/gherkin/parser.rb +3 -3
  37. data/lib/gherkin/parser/meta.txt +5 -4
  38. data/lib/gherkin/parser/root.txt +11 -9
  39. data/lib/gherkin/parser/steps.txt +4 -3
  40. data/lib/gherkin/rb_parser.rb +13 -5
  41. data/lib/gherkin/tools/colors.rb +119 -0
  42. data/lib/gherkin/tools/files.rb +6 -1
  43. data/lib/gherkin/tools/pretty_listener.rb +115 -23
  44. data/ragel/lexer.c.rl.erb +67 -51
  45. data/ragel/lexer.csharp.rl.erb +240 -0
  46. data/ragel/lexer.java.rl.erb +27 -18
  47. data/ragel/lexer.rb.rl.erb +17 -17
  48. data/ragel/lexer_common.rl.erb +8 -8
  49. data/spec/gherkin/c_lexer_spec.rb +4 -4
  50. data/spec/gherkin/csharp_lexer_spec.rb +20 -0
  51. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  52. data/spec/gherkin/fixtures/complex.feature +2 -0
  53. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  54. data/spec/gherkin/fixtures/i18n_fr.feature +1 -0
  55. data/spec/gherkin/fixtures/i18n_no.feature +1 -0
  56. data/spec/gherkin/fixtures/i18n_zh-CN.feature +1 -0
  57. data/spec/gherkin/format/argument_spec.rb +28 -0
  58. data/spec/gherkin/i18n_lexer_spec.rb +4 -4
  59. data/spec/gherkin/i18n_spec.rb +31 -23
  60. data/spec/gherkin/java_lexer_spec.rb +4 -3
  61. data/spec/gherkin/parser_spec.rb +5 -0
  62. data/spec/gherkin/rb_lexer_spec.rb +4 -2
  63. data/spec/gherkin/sexp_recorder.rb +1 -1
  64. data/spec/gherkin/shared/lexer_spec.rb +169 -60
  65. data/spec/gherkin/shared/py_string_spec.rb +6 -0
  66. data/spec/gherkin/shared/row_spec.rb +107 -0
  67. data/spec/gherkin/shared/tags_spec.rb +1 -1
  68. data/spec/gherkin/tools/colors_spec.rb +19 -0
  69. data/spec/gherkin/tools/pretty_listener_spec.rb +147 -0
  70. data/spec/spec_helper.rb +31 -7
  71. data/tasks/compile.rake +81 -7
  72. data/tasks/ragel_task.rb +6 -4
  73. data/tasks/rspec.rake +2 -2
  74. metadata +86 -26
  75. data/lib/gherkin/java_lexer.rb +0 -10
  76. data/spec/gherkin/shared/table_spec.rb +0 -97
@@ -29,7 +29,8 @@ class RagelTask
29
29
  {
30
30
  'c' => "ext/gherkin_lexer_#{@i18n.sanitized_key}/gherkin_lexer_#{@i18n.sanitized_key}.c",
31
31
  'java' => "java/src/gherkin/lexer/#{@i18n.sanitized_key.capitalize}.java",
32
- 'rb' => "lib/gherkin/rb_lexer/#{@i18n.sanitized_key}.rb"
32
+ 'rb' => "lib/gherkin/rb_lexer/#{@i18n.sanitized_key}.rb",
33
+ 'csharp' => "tmp/#{@i18n.sanitized_key}.cs"
33
34
  }[@lang]
34
35
  end
35
36
 
@@ -51,9 +52,10 @@ class RagelTask
51
52
 
52
53
  def flags
53
54
  {
54
- 'c' => '-C',
55
- 'java' => '-J',
56
- 'rb' => '-R'
55
+ 'c' => '-C',
56
+ 'java' => '-J',
57
+ 'rb' => '-R',
58
+ 'csharp' => '-A -L -T0'
57
59
  }[@lang]
58
60
  end
59
61
 
@@ -2,13 +2,13 @@ require 'spec/rake/spectask'
2
2
 
3
3
  Spec::Rake::SpecTask.new(:spec) do |spec|
4
4
  spec.libs << 'lib' << 'spec'
5
- spec.spec_opts << '--color'
5
+ spec.spec_opts << '--color --diff'
6
6
  end
7
7
  task :spec => [:check_dependencies]
8
8
 
9
9
  Spec::Rake::SpecTask.new(:rcov) do |spec|
10
10
  spec.libs << 'lib' << 'spec'
11
- spec.spec_opts << '--color'
11
+ spec.spec_opts << '--color --diff'
12
12
  spec.pattern = 'spec/**/*_spec.rb'
13
13
  spec.rcov = true
14
14
  spec.rcov_opts = %w{--exclude spec\/}
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 3
9
+ version: 1.0.3
5
10
  platform: java
6
11
  authors:
7
12
  - Mike Sassak
@@ -11,49 +16,78 @@ autorequire:
11
16
  bindir: bin
12
17
  cert_chain: []
13
18
 
14
- date: 2009-12-30 00:00:00 +01:00
19
+ date: 2010-03-30 00:00:00 +02:00
15
20
  default_executable: gherkin
16
21
  dependencies:
17
22
  - !ruby/object:Gem::Dependency
18
23
  name: trollop
19
- type: :runtime
20
- version_requirement:
21
- version_requirements: !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
22
26
  requirements:
23
27
  - - ">="
24
28
  - !ruby/object:Gem::Version
29
+ segments:
30
+ - 1
31
+ - 15
25
32
  version: "1.15"
26
- version:
33
+ type: :runtime
34
+ version_requirements: *id001
27
35
  - !ruby/object:Gem::Dependency
28
36
  name: rspec
29
- type: :development
30
- version_requirement:
31
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
32
39
  requirements:
33
40
  - - ">="
34
41
  - !ruby/object:Gem::Version
35
- version: 1.2.9
36
- version:
42
+ segments:
43
+ - 1
44
+ - 3
45
+ - 0
46
+ version: 1.3.0
47
+ type: :development
48
+ version_requirements: *id002
37
49
  - !ruby/object:Gem::Dependency
38
50
  name: cucumber
39
- type: :development
40
- version_requirement:
41
- version_requirements: !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
42
53
  requirements:
43
54
  - - ">="
44
55
  - !ruby/object:Gem::Version
45
- version: 0.5.1
46
- version:
56
+ segments:
57
+ - 0
58
+ - 6
59
+ - 2
60
+ version: 0.6.2
61
+ type: :development
62
+ version_requirements: *id003
47
63
  - !ruby/object:Gem::Dependency
48
64
  name: rake-compiler
49
- type: :development
50
- version_requirement:
51
- version_requirements: !ruby/object:Gem::Requirement
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
52
67
  requirements:
53
68
  - - ">="
54
69
  - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
72
+ - 7
73
+ - 0
55
74
  version: 0.7.0
56
- version:
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: albacore
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ - 1
87
+ - 0
88
+ version: 0.1.0
89
+ type: :development
90
+ version_requirements: *id005
57
91
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
58
92
  email: cukes@googlegroups.com
59
93
  executables:
@@ -64,6 +98,7 @@ extra_rdoc_files:
64
98
  - LICENSE
65
99
  - README.rdoc
66
100
  files:
101
+ - .gitattributes
67
102
  - .gitignore
68
103
  - .mailmap
69
104
  - History.txt
@@ -73,6 +108,7 @@ files:
73
108
  - VERSION.yml
74
109
  - bin/gherkin
75
110
  - cucumber.yml
111
+ - dotnet/.gitignore
76
112
  - features/feature_parser.feature
77
113
  - features/native_lexer.feature
78
114
  - features/parser_with_native_lexer.feature
@@ -86,23 +122,33 @@ files:
86
122
  - java/Gherkin.iml
87
123
  - java/build.xml
88
124
  - java/src/gherkin/FixJava.java
125
+ - java/src/gherkin/I18nLexer.java
89
126
  - java/src/gherkin/Lexer.java
90
127
  - java/src/gherkin/LexingError.java
91
128
  - java/src/gherkin/Listener.java
129
+ - java/src/gherkin/Main.java
92
130
  - java/src/gherkin/ParseError.java
93
131
  - java/src/gherkin/Parser.java
132
+ - java/src/gherkin/formatter/Argument.java
133
+ - java/src/gherkin/formatter/ArgumentFormat.java
134
+ - java/src/gherkin/formatter/Colors.java
135
+ - java/src/gherkin/formatter/Formatter.java
136
+ - java/src/gherkin/formatter/PrettyFormatter.java
94
137
  - java/src/gherkin/lexer/.gitignore
95
138
  - java/src/gherkin/parser/StateMachineReader.java
139
+ - java/test/gherkin/formatter/ArgumentTest.java
96
140
  - lib/.gitignore
97
141
  - lib/gherkin.jar
98
142
  - lib/gherkin.rb
99
143
  - lib/gherkin/c_lexer.rb
100
144
  - lib/gherkin/cli/main.rb
101
145
  - lib/gherkin/core_ext/array.rb
146
+ - lib/gherkin/csharp_lexer.rb
147
+ - lib/gherkin/format/argument.rb
148
+ - lib/gherkin/format/monochrome_format.rb
102
149
  - lib/gherkin/i18n.rb
103
150
  - lib/gherkin/i18n.yml
104
151
  - lib/gherkin/i18n_lexer.rb
105
- - lib/gherkin/java_lexer.rb
106
152
  - lib/gherkin/lexer.rb
107
153
  - lib/gherkin/parser.rb
108
154
  - lib/gherkin/parser/meta.txt
@@ -113,6 +159,7 @@ files:
113
159
  - lib/gherkin/rb_lexer/README.rdoc
114
160
  - lib/gherkin/rb_parser.rb
115
161
  - lib/gherkin/tools.rb
162
+ - lib/gherkin/tools/colors.rb
116
163
  - lib/gherkin/tools/files.rb
117
164
  - lib/gherkin/tools/pretty_listener.rb
118
165
  - lib/gherkin/tools/reformat.rb
@@ -121,18 +168,23 @@ files:
121
168
  - nativegems.sh
122
169
  - ragel/i18n/.gitignore
123
170
  - ragel/lexer.c.rl.erb
171
+ - ragel/lexer.csharp.rl.erb
124
172
  - ragel/lexer.java.rl.erb
125
173
  - ragel/lexer.rb.rl.erb
126
174
  - ragel/lexer_common.rl.erb
127
175
  - spec/gherkin/c_lexer_spec.rb
176
+ - spec/gherkin/csharp_lexer_spec.rb
128
177
  - spec/gherkin/fixtures/1.feature
178
+ - spec/gherkin/fixtures/comments_in_table.feature
129
179
  - spec/gherkin/fixtures/complex.feature
180
+ - spec/gherkin/fixtures/dos_line_endings.feature
130
181
  - spec/gherkin/fixtures/i18n_fr.feature
131
182
  - spec/gherkin/fixtures/i18n_no.feature
132
183
  - spec/gherkin/fixtures/i18n_zh-CN.feature
133
184
  - spec/gherkin/fixtures/simple.feature
134
185
  - spec/gherkin/fixtures/simple_with_comments.feature
135
186
  - spec/gherkin/fixtures/simple_with_tags.feature
187
+ - spec/gherkin/format/argument_spec.rb
136
188
  - spec/gherkin/i18n_lexer_spec.rb
137
189
  - spec/gherkin/i18n_spec.rb
138
190
  - spec/gherkin/java_lexer_spec.rb
@@ -141,8 +193,10 @@ files:
141
193
  - spec/gherkin/sexp_recorder.rb
142
194
  - spec/gherkin/shared/lexer_spec.rb
143
195
  - spec/gherkin/shared/py_string_spec.rb
144
- - spec/gherkin/shared/table_spec.rb
196
+ - spec/gherkin/shared/row_spec.rb
145
197
  - spec/gherkin/shared/tags_spec.rb
198
+ - spec/gherkin/tools/colors_spec.rb
199
+ - spec/gherkin/tools/pretty_listener_spec.rb
146
200
  - spec/spec_helper.rb
147
201
  - tasks/bench.rake
148
202
  - tasks/bench/feature_builder.rb
@@ -166,23 +220,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
220
  requirements:
167
221
  - - ">="
168
222
  - !ruby/object:Gem::Version
223
+ segments:
224
+ - 0
169
225
  version: "0"
170
- version:
171
226
  required_rubygems_version: !ruby/object:Gem::Requirement
172
227
  requirements:
173
228
  - - ">="
174
229
  - !ruby/object:Gem::Version
230
+ segments:
231
+ - 0
175
232
  version: "0"
176
- version:
177
233
  requirements: []
178
234
 
179
235
  rubyforge_project:
180
- rubygems_version: 1.3.5
236
+ rubygems_version: 1.3.6
181
237
  signing_key:
182
238
  specification_version: 3
183
239
  summary: Fast Gherkin lexer/parser
184
240
  test_files:
185
241
  - spec/gherkin/c_lexer_spec.rb
242
+ - spec/gherkin/csharp_lexer_spec.rb
243
+ - spec/gherkin/format/argument_spec.rb
186
244
  - spec/gherkin/i18n_lexer_spec.rb
187
245
  - spec/gherkin/i18n_spec.rb
188
246
  - spec/gherkin/java_lexer_spec.rb
@@ -191,6 +249,8 @@ test_files:
191
249
  - spec/gherkin/sexp_recorder.rb
192
250
  - spec/gherkin/shared/lexer_spec.rb
193
251
  - spec/gherkin/shared/py_string_spec.rb
194
- - spec/gherkin/shared/table_spec.rb
252
+ - spec/gherkin/shared/row_spec.rb
195
253
  - spec/gherkin/shared/tags_spec.rb
254
+ - spec/gherkin/tools/colors_spec.rb
255
+ - spec/gherkin/tools/pretty_listener_spec.rb
196
256
  - spec/spec_helper.rb
@@ -1,10 +0,0 @@
1
- require 'gherkin.jar'
2
-
3
- module Gherkin
4
- module JavaLexer
5
- def self.[](i18n_language)
6
- i18n_lexer_class_name = i18n_language.gsub(/[\s-]/, '').capitalize
7
- Java::GherkinLexer.__send__(i18n_lexer_class_name)
8
- end
9
- end
10
- end
@@ -1,97 +0,0 @@
1
- #encoding: utf-8
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
-
4
- module Gherkin
5
- module Lexer
6
- shared_examples_for "a Gherkin lexer lexing tables" do
7
- tables = {
8
- "|a|b|\n" => [%w{a b}],
9
- "|a|b|c|\n" => [%w{a b c}],
10
- "|c|d|\n|e|f|\n" => [%w{c d}, %w{e f}]
11
- }
12
-
13
- tables.each do |text, expected|
14
- it "should parse #{text}" do
15
- @listener.should_receive(:table).with(t(expected), 1)
16
- @lexer.scan(text.dup)
17
- end
18
- end
19
-
20
- it "should parse a table with many columns" do
21
- @listener.should_receive(:table).with(t([%w{a b c d e f g h i j k l m n o p}]), 1)
22
- @lexer.scan("|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|\n")
23
- end
24
-
25
- it "should parse a multicharacter cell content" do
26
- @listener.should_receive(:table).with(t([%w{foo bar}]), 1)
27
- @lexer.scan("| foo | bar |\n")
28
- end
29
-
30
- it "should parse cells with spaces within the content" do
31
- @listener.should_receive(:table).with(t([["Dill pickle", "Valencia orange"], ["Ruby red grapefruit", "Tire iron"]]), 1)
32
- @lexer.scan("| Dill pickle | Valencia orange |\n| Ruby red grapefruit | Tire iron |\n")
33
- end
34
-
35
- it "should allow utf-8" do
36
- # Fails in 1.9.1!
37
- # 'Gherkin::Lexer::Table should allow utf-8 with using == to evaluate' FAILED
38
- # expected: [[:table, [["ůﻚ", "2"]], 1]],
39
- # got: [[:table, [["\xC5\xAF\xEF\xBB\x9A", "2"]], 1]] (using ==)
40
- # BUT, simply running:
41
- # [[:table, [["ůﻚ", "2"]], 1]].should == [[:table, [["\xC5\xAF\xEF\xBB\x9A", "2"]], 1]]
42
- # passes
43
- #
44
- @lexer.scan(" | ůﻚ | 2 | \n")
45
- @listener.to_sexp.should == [
46
- [:table, [["ůﻚ", "2"]], 1]
47
- ]
48
- end
49
-
50
- it "should allow utf-8 using should_receive" do
51
- @listener.should_receive(:table).with(t([['繁體中文 而且','並且','繁體中文 而且','並且']]), 1)
52
- @lexer.scan("| 繁體中文 而且|並且| 繁體中文 而且|並且|\n")
53
- end
54
-
55
- it "should parse a 2x2 table" do
56
- @listener.should_receive(:table).with(t([%w{1 2}, %w{3 4}]), 1)
57
- @lexer.scan("| 1 | 2 |\n| 3 | 4 |\n")
58
- end
59
-
60
- it "should parse a 2x2 table with several newlines" do
61
- @listener.should_receive(:table).with(t([%w{1 2}, %w{3 4}]), 1)
62
- @lexer.scan("| 1 | 2 |\n| 3 | 4 |\n\n\n")
63
- end
64
-
65
- it "should parse a 2x2 table with empty cells" do
66
- @listener.should_receive(:table).with(t([['1', ''], ['', '4']]), 1)
67
- @lexer.scan("| 1 | |\n|| 4 |\n")
68
- end
69
-
70
- it "should parse a 1x2 table that does not end in a newline" do
71
- @listener.should_receive(:table).with(t([%w{1 2}]), 1)
72
- @lexer.scan("| 1 | 2 |")
73
- end
74
-
75
- it "should parse a 1x2 table without spaces and newline" do
76
- @listener.should_receive(:table).with(t([%w{1 2}]), 1)
77
- @lexer.scan("|1|2|\n")
78
- end
79
-
80
- it "should parse a row with whitespace after the rows" do
81
- @listener.should_receive(:table).with(t([%w{1 2}, %w{a b}]), 1)
82
- @lexer.scan("| 1 | 2 | \n | a | b | \n")
83
- end
84
-
85
- it "should parse a table with lots of whitespace" do
86
- @listener.should_receive(:table).with(t([["abc", "123"]]), 1)
87
- @lexer.scan(" \t| \t abc\t| \t123\t \t\t| \t\t \t \t\n ")
88
- end
89
-
90
- it "should raise LexingError for rows that aren't closed" do
91
- lambda {
92
- @lexer.scan("|| oh hello \n")
93
- }.should raise_error(/Parsing error on line 1: '|| oh hello/)
94
- end
95
- end
96
- end
97
- end