gherkin 2.11.6 → 2.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +0 -1
- data/Gemfile +1 -1
- data/History.md +13 -0
- data/README.md +10 -4
- data/examples/parse_and_output_json.rb +2 -2
- data/ext/gherkin_lexer_ar/gherkin_lexer_ar.c +494 -494
- data/ext/gherkin_lexer_bg/gherkin_lexer_bg.c +30 -30
- data/ext/gherkin_lexer_bm/gherkin_lexer_bm.c +30 -30
- data/ext/gherkin_lexer_ca/gherkin_lexer_ca.c +30 -30
- data/ext/gherkin_lexer_cs/gherkin_lexer_cs.c +30 -30
- data/ext/gherkin_lexer_cy_gb/gherkin_lexer_cy_gb.c +30 -30
- data/ext/gherkin_lexer_da/gherkin_lexer_da.c +30 -30
- data/ext/gherkin_lexer_de/gherkin_lexer_de.c +30 -30
- data/ext/gherkin_lexer_el/extconf.rb +6 -0
- data/ext/gherkin_lexer_el/gherkin_lexer_el.c +1977 -0
- data/ext/gherkin_lexer_en/gherkin_lexer_en.c +30 -30
- data/ext/gherkin_lexer_en_au/gherkin_lexer_en_au.c +30 -30
- data/ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c +30 -30
- data/ext/gherkin_lexer_en_old/extconf.rb +6 -0
- data/ext/gherkin_lexer_en_old/gherkin_lexer_en_old.c +1309 -0
- data/ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c +30 -30
- data/ext/gherkin_lexer_en_scouse/gherkin_lexer_en_scouse.c +30 -30
- data/ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c +30 -30
- data/ext/gherkin_lexer_eo/gherkin_lexer_eo.c +30 -30
- data/ext/gherkin_lexer_es/gherkin_lexer_es.c +30 -30
- data/ext/gherkin_lexer_et/gherkin_lexer_et.c +30 -30
- data/ext/gherkin_lexer_fa/gherkin_lexer_fa.c +30 -30
- data/ext/gherkin_lexer_fi/gherkin_lexer_fi.c +30 -30
- data/ext/gherkin_lexer_fr/gherkin_lexer_fr.c +30 -30
- data/ext/gherkin_lexer_he/gherkin_lexer_he.c +30 -30
- data/ext/gherkin_lexer_hi/gherkin_lexer_hi.c +30 -30
- data/ext/gherkin_lexer_hr/gherkin_lexer_hr.c +30 -30
- data/ext/gherkin_lexer_hu/gherkin_lexer_hu.c +30 -30
- data/ext/gherkin_lexer_id/gherkin_lexer_id.c +30 -30
- data/ext/gherkin_lexer_is/gherkin_lexer_is.c +30 -30
- data/ext/gherkin_lexer_it/gherkin_lexer_it.c +30 -30
- data/ext/gherkin_lexer_ja/gherkin_lexer_ja.c +30 -30
- data/ext/gherkin_lexer_ko/gherkin_lexer_ko.c +30 -30
- data/ext/gherkin_lexer_lt/gherkin_lexer_lt.c +30 -30
- data/ext/gherkin_lexer_lu/gherkin_lexer_lu.c +30 -30
- data/ext/gherkin_lexer_lv/gherkin_lexer_lv.c +30 -30
- data/ext/gherkin_lexer_nl/gherkin_lexer_nl.c +30 -30
- data/ext/gherkin_lexer_no/gherkin_lexer_no.c +30 -30
- data/ext/gherkin_lexer_pl/gherkin_lexer_pl.c +30 -30
- data/ext/gherkin_lexer_pt/gherkin_lexer_pt.c +30 -30
- data/ext/gherkin_lexer_ro/gherkin_lexer_ro.c +30 -30
- data/ext/gherkin_lexer_ru/gherkin_lexer_ru.c +30 -30
- data/ext/gherkin_lexer_sk/gherkin_lexer_sk.c +30 -30
- data/ext/gherkin_lexer_sr_cyrl/gherkin_lexer_sr_cyrl.c +30 -30
- data/ext/gherkin_lexer_sr_latn/gherkin_lexer_sr_latn.c +617 -614
- data/ext/gherkin_lexer_sv/gherkin_lexer_sv.c +30 -30
- data/ext/gherkin_lexer_tl/gherkin_lexer_tl.c +30 -30
- data/ext/gherkin_lexer_tr/gherkin_lexer_tr.c +30 -30
- data/ext/gherkin_lexer_tt/gherkin_lexer_tt.c +30 -30
- data/ext/gherkin_lexer_uk/gherkin_lexer_uk.c +30 -30
- data/ext/gherkin_lexer_uz/gherkin_lexer_uz.c +622 -614
- data/ext/gherkin_lexer_vi/gherkin_lexer_vi.c +30 -30
- data/ext/gherkin_lexer_zh_cn/gherkin_lexer_zh_cn.c +30 -30
- data/ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c +30 -30
- data/features/.cucumber/stepdefs.json +66 -66
- data/features/step_definitions/json_formatter_steps.rb +4 -4
- data/features/step_definitions/json_parser_steps.rb +2 -1
- data/features/support/env.rb +2 -3
- data/gherkin.gemspec +8 -6
- data/lib/gherkin/formatter/json_formatter.rb +5 -5
- data/lib/gherkin/formatter/tag_filter.rb +2 -2
- data/lib/gherkin/i18n.json +28 -0
- data/lib/gherkin/i18n.rb +6 -6
- data/lib/gherkin/json_parser.rb +4 -4
- data/lib/gherkin/native/java.rb +2 -2
- data/lib/gherkin/parser/parser.rb +1 -0
- data/lib/gherkin/platform.rb +12 -0
- data/lib/gherkin/tag_expression.rb +7 -1
- data/spec/gherkin/formatter/json_formatter_spec.rb +74 -3
- data/spec/gherkin/i18n_spec.rb +2 -0
- data/spec/gherkin/json_parser_spec.rb +11 -10
- data/spec/gherkin/parser/parser_spec.rb +1 -1
- data/spec/gherkin/tag_expression_spec.rb +19 -15
- data/spec/spec_helper.rb +4 -1
- data/tasks/rspec.rake +1 -2
- metadata +139 -226
- data/lib/gherkin/lexer/tl.rb +0 -1723
- data/lib/gherkin/lexer/tt.rb +0 -1640
- data/spec/gherkin/output_stream_string_io.rb +0 -20
@@ -16,13 +16,13 @@ Given /^a JSON formatter$/ do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
Then /^the outputted JSON should be:$/ do |expected_json|
|
19
|
-
require '
|
19
|
+
require 'multi_json'
|
20
20
|
@formatter.done
|
21
21
|
actual_json = @out.string
|
22
22
|
puts actual_json
|
23
|
-
puts
|
24
|
-
expected =
|
25
|
-
actual =
|
23
|
+
puts MultiJson.dump(MultiJson.load(actual_json), :pretty => true)
|
24
|
+
expected = MultiJson.load(expected_json)
|
25
|
+
actual = MultiJson.load(actual_json)
|
26
26
|
actual.should == expected
|
27
27
|
end
|
28
28
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'stringio'
|
2
2
|
require 'gherkin/formatter/pretty_formatter'
|
3
3
|
require 'gherkin/json_parser'
|
4
|
+
require 'multi_json'
|
4
5
|
|
5
6
|
Given /^a PrettyFormatter$/ do
|
6
7
|
@io = StringIO.new
|
@@ -12,7 +13,7 @@ Given /^a JSON lexer$/ do
|
|
12
13
|
end
|
13
14
|
|
14
15
|
Given /^the following JSON is parsed:$/ do |text|
|
15
|
-
@json_parser.parse(
|
16
|
+
@json_parser.parse(MultiJson.dump(MultiJson.load(text), :pretty => true))
|
16
17
|
end
|
17
18
|
|
18
19
|
Then /^the outputted text should be:$/ do |expected_text|
|
data/features/support/env.rb
CHANGED
@@ -13,7 +13,6 @@ Bundler.setup
|
|
13
13
|
end
|
14
14
|
require 'gherkin'
|
15
15
|
require 'gherkin/sexp_recorder'
|
16
|
-
require 'gherkin/output_stream_string_io'
|
17
16
|
|
18
17
|
module TransformHelpers
|
19
18
|
def tr_line_number(step_arg)
|
@@ -31,12 +30,12 @@ end
|
|
31
30
|
|
32
31
|
class GherkinWorld
|
33
32
|
include TransformHelpers
|
34
|
-
|
33
|
+
|
35
34
|
def initialize
|
36
35
|
@formatter = Gherkin::SexpRecorder.new
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
World do
|
39
|
+
World do
|
41
40
|
GherkinWorld.new
|
42
41
|
end
|
data/gherkin.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require 'gherkin/platform'
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
4
6
|
s.name = "gherkin"
|
@@ -12,10 +14,10 @@ Gem::Specification.new do |s|
|
|
12
14
|
#
|
13
15
|
# Repeat these step for cucumber (swap `cucumber` with `gherkin`).
|
14
16
|
#
|
15
|
-
# When both are building OK, do a `bundle exec rake install` in both cucumber and gherkin projects, revert the changes in the first 2 steps
|
17
|
+
# When both are building OK, do a `bundle exec rake install` in both cucumber and gherkin projects, revert the changes in the first 2 steps
|
16
18
|
# and release both projects. Do this for both ruby 1.8.7, ruby 1.9.3 and jruby.
|
17
19
|
#
|
18
|
-
s.version =
|
20
|
+
s.version = Gherkin::VERSION
|
19
21
|
s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
|
20
22
|
s.description = "A fast Gherkin lexer/parser based on the Ragel State Machine Compiler."
|
21
23
|
s.summary = "#{s.name}-#{s.version}"
|
@@ -36,11 +38,11 @@ Gem::Specification.new do |s|
|
|
36
38
|
s.files -= Dir['lib/**/*.dll']
|
37
39
|
s.files -= Dir['lib/**/*.bundle']
|
38
40
|
s.files -= Dir['lib/**/*.so']
|
39
|
-
|
41
|
+
|
40
42
|
if ENV['GEM_PLATFORM']
|
41
43
|
puts "GEM_PLATFORM:#{ENV['GEM_PLATFORM']}"
|
42
44
|
end
|
43
|
-
s.platform = ENV['GEM_PLATFORM'] if ENV['GEM_PLATFORM']
|
45
|
+
s.platform = ENV['GEM_PLATFORM'] if ENV['GEM_PLATFORM']
|
44
46
|
case s.platform.to_s
|
45
47
|
when /java/
|
46
48
|
s.files += Dir['lib/*.jar']
|
@@ -56,7 +58,7 @@ Gem::Specification.new do |s|
|
|
56
58
|
end
|
57
59
|
s.files -= Dir['**/.gitignore']
|
58
60
|
|
59
|
-
s.add_runtime_dependency('
|
61
|
+
s.add_runtime_dependency('multi_json', '~> 1.3')
|
60
62
|
|
61
63
|
s.add_development_dependency('cucumber', '>= 1.2.1')
|
62
64
|
s.add_development_dependency('rake', '>= 10.0.3')
|
@@ -64,7 +66,7 @@ Gem::Specification.new do |s|
|
|
64
66
|
s.add_development_dependency('rspec', '~> 2.12.0')
|
65
67
|
s.add_development_dependency('rubyzip', '>= 0.9.9')
|
66
68
|
|
67
|
-
unless ENV['RUBY_CC_VERSION'] ||
|
69
|
+
unless ENV['RUBY_CC_VERSION'] || Gherkin::JRUBY
|
68
70
|
s.add_development_dependency('therubyracer', '>= 0.11.2') if ENV['GHERKIN_JS']
|
69
71
|
# For Documentation:
|
70
72
|
s.add_development_dependency('yard', '>= 0.8.3')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'multi_json'
|
2
2
|
require 'gherkin/formatter/model'
|
3
3
|
require 'gherkin/native'
|
4
4
|
require 'base64'
|
@@ -9,9 +9,9 @@ module Gherkin
|
|
9
9
|
# be turned into JSON.
|
10
10
|
class JSONFormatter
|
11
11
|
native_impl('gherkin')
|
12
|
-
|
12
|
+
|
13
13
|
include Base64
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(io)
|
16
16
|
raise "Must be writeable" unless io.respond_to?(:write)
|
17
17
|
@io = io
|
@@ -20,7 +20,7 @@ module Gherkin
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def done
|
23
|
-
@io.write(@feature_hashes
|
23
|
+
@io.write(MultiJson.dump(@feature_hashes, :pretty => true))
|
24
24
|
end
|
25
25
|
|
26
26
|
def uri(uri)
|
@@ -61,7 +61,7 @@ module Gherkin
|
|
61
61
|
def result(result)
|
62
62
|
@current_step_or_hook['result'] = result.to_hash
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def append_duration(timestamp)
|
66
66
|
#check to make sure result exists (scenario outlines do not have results yet)
|
67
67
|
if !@current_step_or_hook['result'].nil?
|
data/lib/gherkin/i18n.json
CHANGED
@@ -125,6 +125,20 @@
|
|
125
125
|
"and": "*|Und",
|
126
126
|
"but": "*|Aber"
|
127
127
|
},
|
128
|
+
"el": {
|
129
|
+
"name": "Greek",
|
130
|
+
"native": "Ελληνικά",
|
131
|
+
"feature": "Δυνατότητα|Λειτουργία",
|
132
|
+
"background": "Υπόβαθρο",
|
133
|
+
"scenario": "Σενάριο",
|
134
|
+
"scenario_outline": "Περιγραφή Σεναρίου",
|
135
|
+
"examples": "Παραδείγματα|Σενάρια",
|
136
|
+
"given": "*|Δεδομένου|Δεδομένου ότι",
|
137
|
+
"when": "*|Όταν",
|
138
|
+
"then": "*|Τότε",
|
139
|
+
"and": "*|Και",
|
140
|
+
"but": "*|Αλλά"
|
141
|
+
},
|
128
142
|
"en-au": {
|
129
143
|
"name": "Australian",
|
130
144
|
"native": "Australian",
|
@@ -153,6 +167,20 @@
|
|
153
167
|
"and": "*|AN",
|
154
168
|
"but": "*|BUT"
|
155
169
|
},
|
170
|
+
"en-old": {
|
171
|
+
"name": "Old English",
|
172
|
+
"native": "Englisc",
|
173
|
+
"feature": "Hwaet|Hwæt",
|
174
|
+
"background": "Aer|Ær",
|
175
|
+
"scenario": "Swa",
|
176
|
+
"scenario_outline": "Swa hwaer swa|Swa hwær swa",
|
177
|
+
"examples": "Se the|Se þe|Se ðe",
|
178
|
+
"given": "*|Thurh|Þurh|Ðurh",
|
179
|
+
"when": "*|Tha|Þa|Ða",
|
180
|
+
"then": "*|Tha|Þa|Ða|Tha the|Þa þe|Ða ðe",
|
181
|
+
"and": "*|Ond|7",
|
182
|
+
"but": "*|Ac"
|
183
|
+
},
|
156
184
|
"en-pirate": {
|
157
185
|
"name": "Pirate",
|
158
186
|
"native": "Pirate",
|
data/lib/gherkin/i18n.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'gherkin/rubify'
|
3
2
|
require 'gherkin/native'
|
3
|
+
require 'multi_json'
|
4
4
|
|
5
5
|
module Gherkin
|
6
6
|
class I18n
|
@@ -11,7 +11,7 @@ module Gherkin
|
|
11
11
|
FEATURE_ELEMENT_KEYS = %w{feature background scenario scenario_outline examples}
|
12
12
|
STEP_KEYWORD_KEYS = %w{given when then and but}
|
13
13
|
KEYWORD_KEYS = FEATURE_ELEMENT_KEYS + STEP_KEYWORD_KEYS
|
14
|
-
LANGUAGES =
|
14
|
+
LANGUAGES = MultiJson.load(File.open(File.dirname(__FILE__) + '/i18n.json', 'r:utf-8').read)
|
15
15
|
|
16
16
|
class << self
|
17
17
|
include Rubify
|
@@ -30,7 +30,7 @@ module Gherkin
|
|
30
30
|
# there is typically a code generation tool to generate regular expressions for recognising the
|
31
31
|
# various I18n translations of Gherkin's keywords.
|
32
32
|
#
|
33
|
-
# The +keywords+ arguments can be one of <tt>:feature</tt>, <tt>:background</tt>, <tt>:scenario</tt>,
|
33
|
+
# The +keywords+ arguments can be one of <tt>:feature</tt>, <tt>:background</tt>, <tt>:scenario</tt>,
|
34
34
|
# <tt>:scenario_outline</tt>, <tt>:examples</tt>, <tt>:step</tt>.
|
35
35
|
def keyword_regexp(*keywords)
|
36
36
|
unique_keywords = all.map do |i18n|
|
@@ -42,7 +42,7 @@ module Gherkin
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
unique_keywords.flatten.compact.map{|kw| kw.to_s}.sort.reverse.uniq.join('|').gsub(/\*/, '\*')
|
47
47
|
end
|
48
48
|
|
@@ -150,14 +150,14 @@ module Gherkin
|
|
150
150
|
gherkin_keyword_table = KEYWORD_KEYS.map do |key|
|
151
151
|
Formatter::Model::Row.new([], [key, keywords(key).map{|keyword| %{"#{keyword}"}}.join(', ')], nil)
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
code_keyword_table = STEP_KEYWORD_KEYS.map do |key|
|
155
155
|
code_keywords = keywords(key).reject{|keyword| keyword == '* '}.map do |keyword|
|
156
156
|
%{"#{self.class.code_keyword_for(keyword)}"}
|
157
157
|
end.join(', ')
|
158
158
|
Formatter::Model::Row.new([], ["#{key} (code)", code_keywords], nil)
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
pf.table(gherkin_keyword_table + code_keyword_table)
|
162
162
|
io.string
|
163
163
|
end
|
data/lib/gherkin/json_parser.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'gherkin/formatter/model'
|
1
|
+
require 'base64'
|
3
2
|
require 'gherkin/formatter/argument'
|
3
|
+
require 'gherkin/formatter/model'
|
4
4
|
require 'gherkin/native'
|
5
|
-
require '
|
5
|
+
require 'multi_json'
|
6
6
|
|
7
7
|
module Gherkin
|
8
8
|
class JSONParser
|
@@ -17,7 +17,7 @@ module Gherkin
|
|
17
17
|
# Parse a gherkin object +o+, which can either be a JSON String,
|
18
18
|
# or a Hash (from a parsed JSON String).
|
19
19
|
def parse(o)
|
20
|
-
o =
|
20
|
+
o = MultiJson.load(o) if String === o
|
21
21
|
|
22
22
|
o.each do |f|
|
23
23
|
@formatter.uri(f['uri'])
|
data/lib/gherkin/native/java.rb
CHANGED
@@ -32,7 +32,7 @@ class Class
|
|
32
32
|
e.message << "\n#{java_class.name}"
|
33
33
|
raise e
|
34
34
|
rescue NameError => e
|
35
|
-
e.message << "\n args: #{args.inspect}"
|
35
|
+
e.message << "\n args: #{args.inspect}"
|
36
36
|
raise e
|
37
37
|
end
|
38
38
|
end
|
@@ -46,7 +46,7 @@ class Class
|
|
46
46
|
java.util.regex.Pattern.compile(arg.source)
|
47
47
|
when Symbol
|
48
48
|
arg.to_s
|
49
|
-
when IO
|
49
|
+
when IO, StringIO
|
50
50
|
IOWriter.new(arg)
|
51
51
|
else
|
52
52
|
arg
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Detect the platform we're running and warn if it is not supported
|
2
|
+
|
3
|
+
module Gherkin
|
4
|
+
unless defined?(Gherkin::VERSION)
|
5
|
+
VERSION = '2.11.7'
|
6
|
+
JRUBY = defined?(JRUBY_VERSION)
|
7
|
+
|
8
|
+
if !JRUBY && !(RUBY_VERSION =~ /^(1\.8\.7|1\.9\.3|2\.0)/)
|
9
|
+
warn("WARNING: Unsupported Ruby version - #{RUBY_VERSION}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -18,7 +18,13 @@ module Gherkin
|
|
18
18
|
@ands.empty?
|
19
19
|
end
|
20
20
|
|
21
|
+
# <b>DEPRECATED:</b> Please use <tt>evaluate</tt> instead
|
21
22
|
def eval(tags)
|
23
|
+
warn '[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead'
|
24
|
+
evaluate(tags)
|
25
|
+
end
|
26
|
+
|
27
|
+
def evaluate(tags)
|
22
28
|
return true if @ands.flatten.empty?
|
23
29
|
vars = Hash[*tags.map{|tag| [tag.name, true]}.flatten]
|
24
30
|
!!Kernel.eval(ruby_expression)
|
@@ -39,7 +45,7 @@ module Gherkin
|
|
39
45
|
if limit
|
40
46
|
tag_without_negation = negated ? tag_with_negation[1..-1] : tag_with_negation
|
41
47
|
if @limits[tag_without_negation] && @limits[tag_without_negation] != limit.to_i
|
42
|
-
raise "Inconsistent tag limits for #{tag_without_negation}: #{@limits[tag_without_negation]} and #{limit.to_i}"
|
48
|
+
raise "Inconsistent tag limits for #{tag_without_negation}: #{@limits[tag_without_negation]} and #{limit.to_i}"
|
43
49
|
end
|
44
50
|
@limits[tag_without_negation] = limit.to_i
|
45
51
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'stringio'
|
3
2
|
require 'gherkin/formatter/json_formatter'
|
4
3
|
require 'gherkin/formatter/model'
|
4
|
+
require 'multi_json'
|
5
|
+
require 'stringio'
|
5
6
|
|
6
7
|
module Gherkin
|
7
8
|
module Formatter
|
@@ -25,7 +26,7 @@ module Gherkin
|
|
25
26
|
|
26
27
|
f.eof
|
27
28
|
f.done
|
28
|
-
|
29
|
+
|
29
30
|
expected = %{
|
30
31
|
[
|
31
32
|
{
|
@@ -85,7 +86,77 @@ module Gherkin
|
|
85
86
|
}
|
86
87
|
]
|
87
88
|
}
|
88
|
-
|
89
|
+
MultiJson.load(expected).should == MultiJson.load(io.string)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "renders results as pretty json" do
|
93
|
+
io = StringIO.new
|
94
|
+
f = JSONFormatter.new(io)
|
95
|
+
f.uri("f.feature")
|
96
|
+
f.feature(Model::Feature.new([], [], "Feature", nil, nil, nil, nil))
|
97
|
+
f.eof
|
98
|
+
f.done
|
99
|
+
|
100
|
+
expected = %{
|
101
|
+
[
|
102
|
+
{
|
103
|
+
"keyword": "Feature",
|
104
|
+
"uri": "f.feature"
|
105
|
+
}
|
106
|
+
]
|
107
|
+
}
|
108
|
+
io.string.should == MultiJson.dump(MultiJson.load(expected), :pretty => true)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'supports append_duration' do
|
112
|
+
io = StringIO.new
|
113
|
+
f = JSONFormatter.new(io)
|
114
|
+
f.uri("f.feature")
|
115
|
+
f.feature(Model::Feature.new([], [], "Feature", "ff", "", 1, "ff"))
|
116
|
+
f.scenario(Model::Scenario.new([], [], "Scenario", "ss", "", 2, "ff/ss"))
|
117
|
+
f.step(Model::Step.new([], "Given ", "g", 3, nil, nil))
|
118
|
+
f.match(Model::Match.new([], "def.rb:33"))
|
119
|
+
f.result(Model::Result.new(:passed, 3, nil))
|
120
|
+
f.append_duration(1)
|
121
|
+
f.eof
|
122
|
+
f.done
|
123
|
+
expected = %{
|
124
|
+
[
|
125
|
+
{
|
126
|
+
"id": "ff",
|
127
|
+
"uri": "f.feature",
|
128
|
+
"keyword": "Feature",
|
129
|
+
"name": "ff",
|
130
|
+
"line": 1,
|
131
|
+
"description": "",
|
132
|
+
"elements": [
|
133
|
+
{
|
134
|
+
"id": "ff/ss",
|
135
|
+
"keyword": "Scenario",
|
136
|
+
"name": "ss",
|
137
|
+
"line": 2,
|
138
|
+
"description": "",
|
139
|
+
"type": "scenario",
|
140
|
+
"steps": [
|
141
|
+
{
|
142
|
+
"keyword": "Given ",
|
143
|
+
"name": "g",
|
144
|
+
"line": 3,
|
145
|
+
"match": {
|
146
|
+
"location": "def.rb:33"
|
147
|
+
},
|
148
|
+
"result": {
|
149
|
+
"status": "passed",
|
150
|
+
"duration": 1000000000
|
151
|
+
}
|
152
|
+
}
|
153
|
+
]
|
154
|
+
}
|
155
|
+
]
|
156
|
+
}
|
157
|
+
]
|
158
|
+
}
|
159
|
+
MultiJson.load(expected).should == MultiJson.load(io.string)
|
89
160
|
end
|
90
161
|
end
|
91
162
|
end
|
data/spec/gherkin/i18n_spec.rb
CHANGED
@@ -175,10 +175,12 @@ module Gherkin
|
|
175
175
|
| cy-GB | Welsh | Cymraeg |
|
176
176
|
| da | Danish | dansk |
|
177
177
|
| de | German | Deutsch |
|
178
|
+
| el | Greek | Ελληνικά |
|
178
179
|
| en | English | English |
|
179
180
|
| en-Scouse | Scouse | Scouse |
|
180
181
|
| en-au | Australian | Australian |
|
181
182
|
| en-lol | LOLCAT | LOLCAT |
|
183
|
+
| en-old | Old English | Englisc |
|
182
184
|
| en-pirate | Pirate | Pirate |
|
183
185
|
| en-tx | Texan | Texan |
|
184
186
|
| eo | Esperanto | Esperanto |
|