gherkin 1.0.11-i386-mingw32 → 1.0.12-i386-mingw32
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.
- data/History.txt +5 -0
- data/VERSION.yml +3 -2
- data/lib/gherkin/i18n.rb +25 -4
- data/lib/gherkin/parser/filter_listener.rb +7 -2
- data/spec/gherkin/i18n_spec.rb +48 -0
- data/spec/gherkin/parser/filter_listener_spec.rb +27 -0
- metadata +3 -3
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/lib/gherkin/i18n.rb
CHANGED
@@ -15,10 +15,6 @@ module Gherkin
|
|
15
15
|
languages[key] ||= new(key)
|
16
16
|
end
|
17
17
|
|
18
|
-
def languages
|
19
|
-
@languages ||= {}
|
20
|
-
end
|
21
|
-
|
22
18
|
# Returns all keyword translations and aliases of +keywords+, escaped and joined with <tt>|</tt>.
|
23
19
|
# This method is convenient for editor support and syntax highlighting engines for Gherkin, where
|
24
20
|
# there is typically a code generation tool to generate regular expressions for recognising the
|
@@ -43,6 +39,23 @@ module Gherkin
|
|
43
39
|
def code_keyword_for(gherkin_keyword)
|
44
40
|
gherkin_keyword.gsub(/[\s',]/, '').strip
|
45
41
|
end
|
42
|
+
|
43
|
+
def language_table
|
44
|
+
require 'stringio'
|
45
|
+
require 'gherkin/formatter/pretty_formatter'
|
46
|
+
io = StringIO.new
|
47
|
+
pf = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
48
|
+
all.each{|i18n| pf.row([i18n.key, i18n.name, i18n.native], 0)}
|
49
|
+
pf.flush_table
|
50
|
+
io.rewind
|
51
|
+
io.read
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def languages
|
57
|
+
@languages ||= {}
|
58
|
+
end
|
46
59
|
end
|
47
60
|
|
48
61
|
attr_reader :key
|
@@ -133,6 +146,14 @@ module Gherkin
|
|
133
146
|
result
|
134
147
|
end
|
135
148
|
|
149
|
+
def name
|
150
|
+
@keywords['name']
|
151
|
+
end
|
152
|
+
|
153
|
+
def native
|
154
|
+
@keywords['native']
|
155
|
+
end
|
156
|
+
|
136
157
|
def keywords(key, space=false)
|
137
158
|
raise "No #{key} in #{@keywords.inspect}" if @keywords[key].nil?
|
138
159
|
@keywords[key].split('|').map{|kw| space ? keyword_space(kw) : kw}
|
@@ -117,8 +117,13 @@ module Gherkin
|
|
117
117
|
raise "Bad table_state:#{@table_state.inspect}"
|
118
118
|
end
|
119
119
|
when :py_string
|
120
|
-
@
|
121
|
-
|
120
|
+
if @table_state == :background
|
121
|
+
@feature_buffer << sexp
|
122
|
+
@feature_ok ||= filter_match?(*@feature_buffer)
|
123
|
+
else
|
124
|
+
@scenario_buffer << sexp
|
125
|
+
@scenario_ok ||= filter_match?(*@scenario_buffer)
|
126
|
+
end
|
122
127
|
when :eof
|
123
128
|
replay_examples_rows_buffer
|
124
129
|
sexp.replay(@listener)
|
data/spec/gherkin/i18n_spec.rb
CHANGED
@@ -67,6 +67,54 @@ module Gherkin
|
|
67
67
|
I18n.code_keywords.should include(code_keyword)
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
it "should print available languages" do
|
72
|
+
("\n" + I18n.language_table).should == %{
|
73
|
+
| ar | Arabic | العربية |
|
74
|
+
| bg | Bulgarian | български |
|
75
|
+
| ca | Catalan | català |
|
76
|
+
| cs | Czech | Česky |
|
77
|
+
| cy-GB | Welsh | Cymraeg |
|
78
|
+
| da | Danish | dansk |
|
79
|
+
| de | German | Deutsch |
|
80
|
+
| en | English | English |
|
81
|
+
| en-Scouse | Scouse | Scouse |
|
82
|
+
| en-au | Australian | Australian |
|
83
|
+
| en-lol | LOLCAT | LOLCAT |
|
84
|
+
| en-tx | Texan | Texan |
|
85
|
+
| eo | Esperanto | Esperanto |
|
86
|
+
| es | Spanish | español |
|
87
|
+
| et | Estonian | eesti keel |
|
88
|
+
| fi | Finnish | suomi |
|
89
|
+
| fr | French | français |
|
90
|
+
| he | Hebrew | עברית |
|
91
|
+
| hr | Croatian | hrvatski |
|
92
|
+
| hu | Hungarian | magyar |
|
93
|
+
| id | Indonesian | Bahasa Indonesia |
|
94
|
+
| it | Italian | italiano |
|
95
|
+
| ja | Japanese | 日本語 |
|
96
|
+
| ko | Korean | 한국어 |
|
97
|
+
| lt | Lithuanian | lietuvių kalba |
|
98
|
+
| lv | Latvian | latviešu |
|
99
|
+
| nl | Dutch | Nederlands |
|
100
|
+
| no | Norwegian | norsk |
|
101
|
+
| pl | Polish | polski |
|
102
|
+
| pt | Portuguese | português |
|
103
|
+
| ro | Romanian | română |
|
104
|
+
| ro-RO | Romanian (diacritical) | română (diacritical) |
|
105
|
+
| ru | Russian | русский |
|
106
|
+
| sk | Slovak | Slovensky |
|
107
|
+
| sr-Cyrl | Serbian | Српски |
|
108
|
+
| sr-Latn | Serbian (Latin) | Srpski (Latinica) |
|
109
|
+
| sv | Swedish | Svenska |
|
110
|
+
| tr | Turkish | Türkçe |
|
111
|
+
| uk | Ukrainian | Українська |
|
112
|
+
| uz | Uzbek | Узбекча |
|
113
|
+
| vi | Vietnamese | Tiếng Việt |
|
114
|
+
| zh-CN | Chinese simplified | 简体中文 |
|
115
|
+
| zh-TW | Chinese traditional | 繁體中文 |
|
116
|
+
}
|
117
|
+
end
|
70
118
|
end
|
71
119
|
end
|
72
120
|
end
|
@@ -356,6 +356,33 @@ Feature: 3
|
|
356
356
|
verify_filters([:eof], ['@m'])
|
357
357
|
end
|
358
358
|
end
|
359
|
+
|
360
|
+
context "Background with PyString" do
|
361
|
+
it "should replay itself properly" do
|
362
|
+
@input = %{#language:en
|
363
|
+
Feature: 2
|
364
|
+
Background: 3
|
365
|
+
Given 4
|
366
|
+
"""
|
367
|
+
6
|
368
|
+
"""
|
369
|
+
|
370
|
+
Scenario: 9
|
371
|
+
Given 10
|
372
|
+
"""
|
373
|
+
12
|
374
|
+
"""
|
375
|
+
|
376
|
+
Scenario: 15
|
377
|
+
Given 16
|
378
|
+
"""
|
379
|
+
18
|
380
|
+
"""
|
381
|
+
}
|
382
|
+
|
383
|
+
verify_filters([1,2,3,4,5,15,16,17,:eof], [15])
|
384
|
+
end
|
385
|
+
end
|
359
386
|
end
|
360
387
|
end
|
361
388
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 12
|
9
|
+
version: 1.0.12
|
10
10
|
platform: i386-mingw32
|
11
11
|
authors:
|
12
12
|
- Mike Sassak
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-04-
|
19
|
+
date: 2010-04-18 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|