gherkin 2.11.7 → 2.11.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/.ruby-gemset +1 -0
  2. data/.ruby-version +1 -0
  3. data/History.md +6 -0
  4. data/README.md +7 -9
  5. data/ext/gherkin_lexer_ar/gherkin_lexer_ar.c +494 -494
  6. data/ext/gherkin_lexer_bg/gherkin_lexer_bg.c +30 -30
  7. data/ext/gherkin_lexer_bm/gherkin_lexer_bm.c +30 -30
  8. data/ext/gherkin_lexer_ca/gherkin_lexer_ca.c +30 -30
  9. data/ext/gherkin_lexer_cs/gherkin_lexer_cs.c +30 -30
  10. data/ext/gherkin_lexer_cy_gb/gherkin_lexer_cy_gb.c +30 -30
  11. data/ext/gherkin_lexer_da/gherkin_lexer_da.c +30 -30
  12. data/ext/gherkin_lexer_de/gherkin_lexer_de.c +30 -30
  13. data/ext/gherkin_lexer_el/gherkin_lexer_el.c +30 -30
  14. data/ext/gherkin_lexer_en/gherkin_lexer_en.c +30 -30
  15. data/ext/gherkin_lexer_en_au/gherkin_lexer_en_au.c +30 -30
  16. data/ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c +30 -30
  17. data/ext/gherkin_lexer_en_old/gherkin_lexer_en_old.c +30 -30
  18. data/ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c +30 -30
  19. data/ext/gherkin_lexer_en_scouse/gherkin_lexer_en_scouse.c +30 -30
  20. data/ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c +30 -30
  21. data/ext/gherkin_lexer_eo/gherkin_lexer_eo.c +30 -30
  22. data/ext/gherkin_lexer_es/gherkin_lexer_es.c +30 -30
  23. data/ext/gherkin_lexer_et/gherkin_lexer_et.c +30 -30
  24. data/ext/gherkin_lexer_fa/gherkin_lexer_fa.c +30 -30
  25. data/ext/gherkin_lexer_fi/gherkin_lexer_fi.c +30 -30
  26. data/ext/gherkin_lexer_fr/gherkin_lexer_fr.c +30 -30
  27. data/ext/gherkin_lexer_gl/extconf.rb +6 -0
  28. data/ext/gherkin_lexer_gl/gherkin_lexer_gl.c +1374 -0
  29. data/ext/gherkin_lexer_he/gherkin_lexer_he.c +30 -30
  30. data/ext/gherkin_lexer_hi/gherkin_lexer_hi.c +30 -30
  31. data/ext/gherkin_lexer_hr/gherkin_lexer_hr.c +30 -30
  32. data/ext/gherkin_lexer_hu/gherkin_lexer_hu.c +30 -30
  33. data/ext/gherkin_lexer_id/gherkin_lexer_id.c +30 -30
  34. data/ext/gherkin_lexer_is/gherkin_lexer_is.c +30 -30
  35. data/ext/gherkin_lexer_it/gherkin_lexer_it.c +30 -30
  36. data/ext/gherkin_lexer_ja/gherkin_lexer_ja.c +30 -30
  37. data/ext/gherkin_lexer_ko/gherkin_lexer_ko.c +30 -30
  38. data/ext/gherkin_lexer_lt/gherkin_lexer_lt.c +30 -30
  39. data/ext/gherkin_lexer_lu/gherkin_lexer_lu.c +30 -30
  40. data/ext/gherkin_lexer_lv/gherkin_lexer_lv.c +30 -30
  41. data/ext/gherkin_lexer_nl/gherkin_lexer_nl.c +30 -30
  42. data/ext/gherkin_lexer_no/gherkin_lexer_no.c +30 -30
  43. data/ext/gherkin_lexer_pl/gherkin_lexer_pl.c +30 -30
  44. data/ext/gherkin_lexer_pt/gherkin_lexer_pt.c +30 -30
  45. data/ext/gherkin_lexer_ro/gherkin_lexer_ro.c +30 -30
  46. data/ext/gherkin_lexer_ru/gherkin_lexer_ru.c +30 -30
  47. data/ext/gherkin_lexer_sk/gherkin_lexer_sk.c +30 -30
  48. data/ext/gherkin_lexer_sr_cyrl/gherkin_lexer_sr_cyrl.c +30 -30
  49. data/ext/gherkin_lexer_sr_latn/gherkin_lexer_sr_latn.c +614 -617
  50. data/ext/gherkin_lexer_sv/gherkin_lexer_sv.c +30 -30
  51. data/ext/gherkin_lexer_tl/gherkin_lexer_tl.c +30 -30
  52. data/ext/gherkin_lexer_tr/gherkin_lexer_tr.c +30 -30
  53. data/ext/gherkin_lexer_tt/gherkin_lexer_tt.c +30 -30
  54. data/ext/gherkin_lexer_uk/gherkin_lexer_uk.c +30 -30
  55. data/ext/gherkin_lexer_uz/gherkin_lexer_uz.c +614 -622
  56. data/ext/gherkin_lexer_vi/gherkin_lexer_vi.c +30 -30
  57. data/ext/gherkin_lexer_zh_cn/gherkin_lexer_zh_cn.c +30 -30
  58. data/ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c +30 -30
  59. data/gherkin.gemspec +3 -3
  60. data/install_mingw_os_x.sh +3 -5
  61. data/lib/gherkin/i18n.json +14 -0
  62. data/lib/gherkin/i18n.rb +1 -0
  63. data/lib/gherkin/lexer/i18n_lexer.rb +3 -2
  64. data/lib/gherkin/parser/parser.rb +2 -2
  65. data/lib/gherkin/platform.rb +1 -1
  66. data/spec/gherkin/i18n_spec.rb +6 -0
  67. data/spec/gherkin/lexer/i18n_lexer_spec.rb +44 -26
  68. data/tasks/ragel_task.rb +3 -1
  69. data/tasks/rspec.rake +3 -0
  70. metadata +231 -137
  71. checksums.yaml +0 -15
  72. data/.rvmrc +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- #line 1 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
2
+ #line 1 "ragel/i18n/zh_tw.c.rl"
3
3
  #include <assert.h>
4
4
  #include <ruby.h>
5
5
 
@@ -80,7 +80,7 @@ static VALUE rb_eGherkinLexingError;
80
80
  lexer->line_number)
81
81
 
82
82
 
83
- #line 254 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
83
+ #line 254 "ragel/i18n/zh_tw.c.rl"
84
84
 
85
85
 
86
86
  /** Data **/
@@ -739,7 +739,7 @@ static const int lexer_error = 0;
739
739
  static const int lexer_en_main = 1;
740
740
 
741
741
 
742
- #line 258 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
742
+ #line 258 "ragel/i18n/zh_tw.c.rl"
743
743
 
744
744
  static VALUE
745
745
  unindent(VALUE con, int start_col)
@@ -912,7 +912,7 @@ static VALUE CLexer_scan(VALUE self, VALUE input)
912
912
  cs = lexer_start;
913
913
  }
914
914
 
915
- #line 425 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
915
+ #line 425 "ragel/i18n/zh_tw.c.rl"
916
916
 
917
917
  #line 918 "ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c"
918
918
  {
@@ -988,7 +988,7 @@ _match:
988
988
  switch ( *_acts++ )
989
989
  {
990
990
  case 0:
991
- #line 83 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
991
+ #line 83 "ragel/i18n/zh_tw.c.rl"
992
992
  {
993
993
  MARK(content_start, p);
994
994
  lexer->current_line = lexer->line_number;
@@ -996,20 +996,20 @@ _match:
996
996
  }
997
997
  break;
998
998
  case 1:
999
- #line 89 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
999
+ #line 89 "ragel/i18n/zh_tw.c.rl"
1000
1000
  {
1001
1001
  MARK(content_start, p);
1002
1002
  }
1003
1003
  break;
1004
1004
  case 2:
1005
- #line 93 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1005
+ #line 93 "ragel/i18n/zh_tw.c.rl"
1006
1006
  {
1007
1007
  lexer->current_line = lexer->line_number;
1008
1008
  lexer->start_col = p - data - lexer->last_newline;
1009
1009
  }
1010
1010
  break;
1011
1011
  case 3:
1012
- #line 98 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1012
+ #line 98 "ragel/i18n/zh_tw.c.rl"
1013
1013
  {
1014
1014
  int len = LEN(content_start, PTR_TO(final_newline));
1015
1015
  int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end));
@@ -1021,49 +1021,49 @@ _match:
1021
1021
  }
1022
1022
  break;
1023
1023
  case 4:
1024
- #line 108 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1024
+ #line 108 "ragel/i18n/zh_tw.c.rl"
1025
1025
  {
1026
1026
  MARK(docstring_content_type_start, p);
1027
1027
  }
1028
1028
  break;
1029
1029
  case 5:
1030
- #line 112 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1030
+ #line 112 "ragel/i18n/zh_tw.c.rl"
1031
1031
  {
1032
1032
  MARK(docstring_content_type_end, p);
1033
1033
  }
1034
1034
  break;
1035
1035
  case 6:
1036
- #line 116 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1036
+ #line 116 "ragel/i18n/zh_tw.c.rl"
1037
1037
  {
1038
1038
  STORE_KW_END_CON(feature);
1039
1039
  }
1040
1040
  break;
1041
1041
  case 7:
1042
- #line 120 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1042
+ #line 120 "ragel/i18n/zh_tw.c.rl"
1043
1043
  {
1044
1044
  STORE_KW_END_CON(background);
1045
1045
  }
1046
1046
  break;
1047
1047
  case 8:
1048
- #line 124 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1048
+ #line 124 "ragel/i18n/zh_tw.c.rl"
1049
1049
  {
1050
1050
  STORE_KW_END_CON(scenario);
1051
1051
  }
1052
1052
  break;
1053
1053
  case 9:
1054
- #line 128 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1054
+ #line 128 "ragel/i18n/zh_tw.c.rl"
1055
1055
  {
1056
1056
  STORE_KW_END_CON(scenario_outline);
1057
1057
  }
1058
1058
  break;
1059
1059
  case 10:
1060
- #line 132 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1060
+ #line 132 "ragel/i18n/zh_tw.c.rl"
1061
1061
  {
1062
1062
  STORE_KW_END_CON(examples);
1063
1063
  }
1064
1064
  break;
1065
1065
  case 11:
1066
- #line 136 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1066
+ #line 136 "ragel/i18n/zh_tw.c.rl"
1067
1067
  {
1068
1068
  store_kw_con(listener, "step",
1069
1069
  PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end)),
@@ -1072,34 +1072,34 @@ _match:
1072
1072
  }
1073
1073
  break;
1074
1074
  case 12:
1075
- #line 143 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1075
+ #line 143 "ragel/i18n/zh_tw.c.rl"
1076
1076
  {
1077
1077
  STORE_ATTR(comment);
1078
1078
  lexer->mark = 0;
1079
1079
  }
1080
1080
  break;
1081
1081
  case 13:
1082
- #line 148 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1082
+ #line 148 "ragel/i18n/zh_tw.c.rl"
1083
1083
  {
1084
1084
  STORE_ATTR(tag);
1085
1085
  lexer->mark = 0;
1086
1086
  }
1087
1087
  break;
1088
1088
  case 14:
1089
- #line 153 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1089
+ #line 153 "ragel/i18n/zh_tw.c.rl"
1090
1090
  {
1091
1091
  lexer->line_number += 1;
1092
1092
  MARK(final_newline, p);
1093
1093
  }
1094
1094
  break;
1095
1095
  case 15:
1096
- #line 158 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1096
+ #line 158 "ragel/i18n/zh_tw.c.rl"
1097
1097
  {
1098
1098
  MARK(last_newline, p + 1);
1099
1099
  }
1100
1100
  break;
1101
1101
  case 16:
1102
- #line 162 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1102
+ #line 162 "ragel/i18n/zh_tw.c.rl"
1103
1103
  {
1104
1104
  if (lexer->mark == 0) {
1105
1105
  MARK(mark, p);
@@ -1107,7 +1107,7 @@ _match:
1107
1107
  }
1108
1108
  break;
1109
1109
  case 17:
1110
- #line 168 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1110
+ #line 168 "ragel/i18n/zh_tw.c.rl"
1111
1111
  {
1112
1112
  MARK(keyword_end, p);
1113
1113
  MARK(keyword_start, PTR_TO(mark));
@@ -1116,13 +1116,13 @@ _match:
1116
1116
  }
1117
1117
  break;
1118
1118
  case 18:
1119
- #line 175 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1119
+ #line 175 "ragel/i18n/zh_tw.c.rl"
1120
1120
  {
1121
1121
  MARK(content_end, p);
1122
1122
  }
1123
1123
  break;
1124
1124
  case 19:
1125
- #line 179 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1125
+ #line 179 "ragel/i18n/zh_tw.c.rl"
1126
1126
  {
1127
1127
  p = p - 1;
1128
1128
  lexer->current_line = lexer->line_number;
@@ -1130,13 +1130,13 @@ _match:
1130
1130
  }
1131
1131
  break;
1132
1132
  case 20:
1133
- #line 185 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1133
+ #line 185 "ragel/i18n/zh_tw.c.rl"
1134
1134
  {
1135
1135
  MARK(content_start, p);
1136
1136
  }
1137
1137
  break;
1138
1138
  case 21:
1139
- #line 189 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1139
+ #line 189 "ragel/i18n/zh_tw.c.rl"
1140
1140
  {
1141
1141
  VALUE re_pipe, re_newline, re_backslash;
1142
1142
  VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p));
@@ -1152,13 +1152,13 @@ _match:
1152
1152
  }
1153
1153
  break;
1154
1154
  case 22:
1155
- #line 203 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1155
+ #line 203 "ragel/i18n/zh_tw.c.rl"
1156
1156
  {
1157
1157
  rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line));
1158
1158
  }
1159
1159
  break;
1160
1160
  case 23:
1161
- #line 207 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1161
+ #line 207 "ragel/i18n/zh_tw.c.rl"
1162
1162
  {
1163
1163
  int line;
1164
1164
  if (cs < lexer_first_final) {
@@ -1221,7 +1221,7 @@ _again:
1221
1221
  while ( __nacts-- > 0 ) {
1222
1222
  switch ( *__acts++ ) {
1223
1223
  case 23:
1224
- #line 207 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1224
+ #line 207 "ragel/i18n/zh_tw.c.rl"
1225
1225
  {
1226
1226
  int line;
1227
1227
  if (cs < lexer_first_final) {
@@ -1275,7 +1275,7 @@ _again:
1275
1275
  _out: {}
1276
1276
  }
1277
1277
 
1278
- #line 426 "/home/son/work/github/cucumber/gherkin/tasks/../ragel/i18n/zh_tw.c.rl"
1278
+ #line 426 "ragel/i18n/zh_tw.c.rl"
1279
1279
 
1280
1280
  assert(p <= pe && "data overflow after parsing execute");
1281
1281
  assert(lexer->content_start <= len && "content starts after data end");
data/gherkin.gemspec CHANGED
@@ -60,14 +60,14 @@ Gem::Specification.new do |s|
60
60
 
61
61
  s.add_runtime_dependency('multi_json', '~> 1.3')
62
62
 
63
- s.add_development_dependency('cucumber', '>= 1.2.1')
63
+ s.add_development_dependency('cucumber', '>= 1.2.5')
64
64
  s.add_development_dependency('rake', '>= 10.0.3')
65
65
  s.add_development_dependency('bundler', '>= 1.2.3') # Make sure it's in sync with /.travis.yml
66
- s.add_development_dependency('rspec', '~> 2.12.0')
66
+ s.add_development_dependency('rspec', '~> 2.13.0')
67
67
  s.add_development_dependency('rubyzip', '>= 0.9.9')
68
68
 
69
69
  unless ENV['RUBY_CC_VERSION'] || Gherkin::JRUBY
70
- s.add_development_dependency('therubyracer', '>= 0.11.2') if ENV['GHERKIN_JS']
70
+ s.add_development_dependency('therubyracer', '>= 0.11.4') if ENV['GHERKIN_JS']
71
71
  # For Documentation:
72
72
  s.add_development_dependency('yard', '>= 0.8.3')
73
73
  s.add_development_dependency('rdiscount', '>= 1.6.8')
@@ -1,7 +1,5 @@
1
1
  #!/bin/sh
2
-
3
2
  mkdir -p /usr/local/mingw
4
- cd /usr/local/mingw
5
- # Don't attempt any of the newer versions - they don't work (gcc 4.7.0)
6
- wget http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Automated%20Builds/mingw-w32-1.0-bin_i686-darwin_20110819.tar.bz2
7
- tar xvfj mingw-w32-1.0-bin_i686-darwin_20110819.tar.bz2
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
@@ -307,6 +307,20 @@
307
307
  "and": "*|Et",
308
308
  "but": "*|Mais"
309
309
  },
310
+ "gl": {
311
+ "name": "Galician",
312
+ "native": "galego",
313
+ "background": "Contexto",
314
+ "feature": "Característica",
315
+ "scenario": "Escenario",
316
+ "scenario_outline": "Esbozo do escenario",
317
+ "examples": "Exemplos",
318
+ "given": "*|Dado|Dada|Dados|Dadas",
319
+ "when": "*|Cando",
320
+ "then": "*|Entón|Logo",
321
+ "and": "*|E",
322
+ "but": "*|Mais|Pero"
323
+ },
310
324
  "he": {
311
325
  "name": "Hebrew",
312
326
  "native": "עברית",
data/lib/gherkin/i18n.rb CHANGED
@@ -131,6 +131,7 @@ module Gherkin
131
131
  def code_keywords
132
132
  result = step_keywords.map{|keyword| self.class.code_keyword_for(keyword)}
133
133
  result.delete('*')
134
+ result.delete_if {|kw| kw =~ /^\d/}
134
135
  result
135
136
  end
136
137
 
@@ -14,9 +14,10 @@ module Gherkin
14
14
  LANGUAGE_PATTERN = /^(\xEF\xBB\xBF)?\s*#\s*language\s*:\s*([a-zA-Z\-]+)/ #:nodoc:
15
15
  attr_reader :i18n_language
16
16
 
17
- def initialize(listener, force_ruby=false)
17
+ def initialize(listener, force_ruby=false, iso_code='en')
18
18
  @listener = listener
19
19
  @force_ruby = force_ruby
20
+ @iso_code = iso_code
20
21
  end
21
22
 
22
23
  def scan(source)
@@ -31,7 +32,7 @@ module Gherkin
31
32
  end
32
33
 
33
34
  def lang(source)
34
- key = 'en'
35
+ key = @iso_code
35
36
  source.each_line do |line|
36
37
  break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line
37
38
  if LANGUAGE_PATTERN =~ line
@@ -15,13 +15,13 @@ module Gherkin
15
15
  native_impl('gherkin')
16
16
 
17
17
  # Initialize the parser. +machine_name+ refers to a state machine table.
18
- def initialize(formatter, raise_on_error=true, machine_name='root', force_ruby=false)
18
+ def initialize(formatter, raise_on_error=true, machine_name='root', force_ruby=false, iso_code = 'en')
19
19
  @formatter = formatter
20
20
  @listener = Listener::FormatterListener.new(@formatter)
21
21
  @raise_on_error = raise_on_error
22
22
  @machine_name = machine_name
23
23
  @machines = []
24
- @lexer = Gherkin::Lexer::I18nLexer.new(self, force_ruby)
24
+ @lexer = Gherkin::Lexer::I18nLexer.new(self, force_ruby, iso_code)
25
25
  end
26
26
 
27
27
  def parse(gherkin, feature_uri, line_offset)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Gherkin
4
4
  unless defined?(Gherkin::VERSION)
5
- VERSION = '2.11.7'
5
+ VERSION = '2.11.8'
6
6
  JRUBY = defined?(JRUBY_VERSION)
7
7
 
8
8
  if !JRUBY && !(RUBY_VERSION =~ /^(1\.8\.7|1\.9\.3|2\.0)/)
@@ -189,6 +189,7 @@ module Gherkin
189
189
  | fa | Persian | فارسی |
190
190
  | fi | Finnish | suomi |
191
191
  | fr | French | français |
192
+ | gl | Galician | galego |
192
193
  | he | Hebrew | עברית |
193
194
  | hi | Hindi | हिंदी |
194
195
  | hr | Croatian | hrvatski |
@@ -241,6 +242,11 @@ module Gherkin
241
242
  | but (code) | "Mais" |
242
243
  }
243
244
  end
245
+
246
+ it "should not list keywords that start with a number" do
247
+ Gherkin::I18n.get('en-old').code_keywords.should include("Ðaðe")
248
+ Gherkin::I18n.get('en-old').code_keywords.should_not include("7")
249
+ end
244
250
  end
245
251
  end
246
252
  end
@@ -4,39 +4,57 @@ require 'spec_helper'
4
4
  module Gherkin
5
5
  module Lexer
6
6
  describe I18nLexer do
7
- before do
8
- @lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false)
9
- end
7
+ context "when default ios_code is 'en'" do
8
+ before do
9
+ @lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false)
10
+ end
10
11
 
11
- it "should store the i18n language of the last scanned feature" do
12
- @lexer.scan("# language: fr\n")
13
- @lexer.i18n_language.iso_code.should == "fr"
14
- @lexer.scan("# language: no\n")
15
- @lexer.i18n_language.iso_code.should == "no"
16
- end
12
+ it "should store the i18n language of the last scanned feature" do
13
+ @lexer.scan("# language: fr\n")
14
+ @lexer.i18n_language.iso_code.should == "fr"
15
+ @lexer.scan("# language: no\n")
16
+ @lexer.i18n_language.iso_code.should == "no"
17
+ end
17
18
 
18
- it "should detect language when there are spaces and CRLF" do
19
- @lexer.scan("# language: da \r\n")
20
- @lexer.i18n_language.iso_code.should == "da"
21
- end
19
+ it "should detect language when there are spaces and CRLF" do
20
+ @lexer.scan("# language: da \r\n")
21
+ @lexer.i18n_language.iso_code.should == "da"
22
+ end
22
23
 
23
- it "should detect language when the language comment is not the first line" do
24
- @lexer.scan("# hello\n# language: no\n")
25
- @lexer.i18n_language.iso_code.should == "no"
26
- end
24
+ it "should detect language when the language comment is not the first line" do
25
+ @lexer.scan("# hello\n# language: no\n")
26
+ @lexer.i18n_language.iso_code.should == "no"
27
+ end
27
28
 
28
- it "should detect language when the language is on the third line, and there are empty lines above" do
29
- @lexer.scan("# hello\n\n# language: no\n")
30
- @lexer.i18n_language.iso_code.should == "no"
31
- end
29
+ it "should detect language when the language is on the third line, and there are empty lines above" do
30
+ @lexer.scan("# hello\n\n# language: no\n")
31
+ @lexer.i18n_language.iso_code.should == "no"
32
+ end
33
+
34
+ it "should use English i18n by default" do
35
+ @lexer.scan("Feature: foo\n")
36
+ @lexer.i18n_language.iso_code.should == "en"
37
+ end
32
38
 
33
- it "should use English i18n by default" do
34
- @lexer.scan("Feature: foo\n")
35
- @lexer.i18n_language.iso_code.should == "en"
39
+ it "should === its ruby class, even when the impl is Java" do
40
+ Gherkin::Lexer::I18nLexer.should === Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, true)
41
+ end
36
42
  end
37
43
 
38
- it "should === its ruby class, even when the impl is Java" do
39
- Gherkin::Lexer::I18nLexer.should === Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, true)
44
+ context "when default ios_code is 'ja'" do
45
+ before do
46
+ @lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false, 'ja')
47
+ end
48
+
49
+ it "should store the i18n language of the last scanned feature" do
50
+ @lexer.scan("# language: en")
51
+ @lexer.i18n_language.iso_code.should == "en"
52
+ end
53
+
54
+ it "should use Japanese" do
55
+ @lexer.scan("機能: foo\n")
56
+ @lexer.i18n_language.iso_code.should == "ja"
57
+ end
40
58
  end
41
59
  end
42
60
  end