ruby_speech 2.1.0-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 (90) hide show
  1. data/.gitignore +12 -0
  2. data/.rspec +3 -0
  3. data/.travis.yml +17 -0
  4. data/CHANGELOG.md +144 -0
  5. data/Gemfile +3 -0
  6. data/Guardfile +9 -0
  7. data/LICENSE.md +20 -0
  8. data/README.md +314 -0
  9. data/Rakefile +34 -0
  10. data/assets/grammar-core.xsd +317 -0
  11. data/assets/grammar.xsd +37 -0
  12. data/assets/synthesis-core.xsd +445 -0
  13. data/assets/synthesis.xsd +63 -0
  14. data/assets/xml.xsd +287 -0
  15. data/ext/ruby_speech/RubySpeechGRXMLMatcher.java +64 -0
  16. data/ext/ruby_speech/RubySpeechService.java +23 -0
  17. data/ext/ruby_speech/extconf.rb +7 -0
  18. data/ext/ruby_speech/ruby_speech.c +97 -0
  19. data/lib/ruby_speech/generic_element.rb +169 -0
  20. data/lib/ruby_speech/grxml/element.rb +29 -0
  21. data/lib/ruby_speech/grxml/grammar.rb +189 -0
  22. data/lib/ruby_speech/grxml/item.rb +144 -0
  23. data/lib/ruby_speech/grxml/match.rb +16 -0
  24. data/lib/ruby_speech/grxml/matcher.rb +126 -0
  25. data/lib/ruby_speech/grxml/max_match.rb +6 -0
  26. data/lib/ruby_speech/grxml/no_match.rb +10 -0
  27. data/lib/ruby_speech/grxml/one_of.rb +31 -0
  28. data/lib/ruby_speech/grxml/potential_match.rb +10 -0
  29. data/lib/ruby_speech/grxml/rule.rb +73 -0
  30. data/lib/ruby_speech/grxml/ruleref.rb +69 -0
  31. data/lib/ruby_speech/grxml/tag.rb +29 -0
  32. data/lib/ruby_speech/grxml/token.rb +31 -0
  33. data/lib/ruby_speech/grxml.rb +39 -0
  34. data/lib/ruby_speech/nlsml/builder.rb +34 -0
  35. data/lib/ruby_speech/nlsml/document.rb +120 -0
  36. data/lib/ruby_speech/nlsml.rb +18 -0
  37. data/lib/ruby_speech/ruby_speech.jar +0 -0
  38. data/lib/ruby_speech/ssml/audio.rb +47 -0
  39. data/lib/ruby_speech/ssml/break.rb +62 -0
  40. data/lib/ruby_speech/ssml/desc.rb +24 -0
  41. data/lib/ruby_speech/ssml/element.rb +23 -0
  42. data/lib/ruby_speech/ssml/emphasis.rb +44 -0
  43. data/lib/ruby_speech/ssml/mark.rb +43 -0
  44. data/lib/ruby_speech/ssml/p.rb +25 -0
  45. data/lib/ruby_speech/ssml/phoneme.rb +72 -0
  46. data/lib/ruby_speech/ssml/prosody.rb +172 -0
  47. data/lib/ruby_speech/ssml/s.rb +25 -0
  48. data/lib/ruby_speech/ssml/say_as.rb +100 -0
  49. data/lib/ruby_speech/ssml/speak.rb +27 -0
  50. data/lib/ruby_speech/ssml/sub.rb +42 -0
  51. data/lib/ruby_speech/ssml/voice.rb +108 -0
  52. data/lib/ruby_speech/ssml.rb +39 -0
  53. data/lib/ruby_speech/version.rb +3 -0
  54. data/lib/ruby_speech/xml/language.rb +13 -0
  55. data/lib/ruby_speech/xml.rb +11 -0
  56. data/lib/ruby_speech.rb +36 -0
  57. data/ruby_speech.gemspec +42 -0
  58. data/spec/ruby_speech/grxml/grammar_spec.rb +341 -0
  59. data/spec/ruby_speech/grxml/item_spec.rb +192 -0
  60. data/spec/ruby_speech/grxml/match_spec.rb +15 -0
  61. data/spec/ruby_speech/grxml/matcher_spec.rb +688 -0
  62. data/spec/ruby_speech/grxml/max_match_spec.rb +17 -0
  63. data/spec/ruby_speech/grxml/no_match_spec.rb +17 -0
  64. data/spec/ruby_speech/grxml/one_of_spec.rb +49 -0
  65. data/spec/ruby_speech/grxml/potential_match_spec.rb +17 -0
  66. data/spec/ruby_speech/grxml/rule_spec.rb +125 -0
  67. data/spec/ruby_speech/grxml/ruleref_spec.rb +55 -0
  68. data/spec/ruby_speech/grxml/tag_spec.rb +41 -0
  69. data/spec/ruby_speech/grxml/token_spec.rb +62 -0
  70. data/spec/ruby_speech/grxml_spec.rb +339 -0
  71. data/spec/ruby_speech/nlsml_spec.rb +353 -0
  72. data/spec/ruby_speech/ssml/audio_spec.rb +121 -0
  73. data/spec/ruby_speech/ssml/break_spec.rb +100 -0
  74. data/spec/ruby_speech/ssml/desc_spec.rb +57 -0
  75. data/spec/ruby_speech/ssml/emphasis_spec.rb +110 -0
  76. data/spec/ruby_speech/ssml/mark_spec.rb +53 -0
  77. data/spec/ruby_speech/ssml/p_spec.rb +96 -0
  78. data/spec/ruby_speech/ssml/phoneme_spec.rb +65 -0
  79. data/spec/ruby_speech/ssml/prosody_spec.rb +309 -0
  80. data/spec/ruby_speech/ssml/s_spec.rb +92 -0
  81. data/spec/ruby_speech/ssml/say_as_spec.rb +71 -0
  82. data/spec/ruby_speech/ssml/speak_spec.rb +166 -0
  83. data/spec/ruby_speech/ssml/sub_spec.rb +57 -0
  84. data/spec/ruby_speech/ssml/voice_spec.rb +200 -0
  85. data/spec/ruby_speech/ssml_spec.rb +285 -0
  86. data/spec/ruby_speech_spec.rb +124 -0
  87. data/spec/spec_helper.rb +21 -0
  88. data/spec/support/match_examples.rb +43 -0
  89. data/spec/support/matchers.rb +46 -0
  90. metadata +405 -0
@@ -0,0 +1,341 @@
1
+ require 'spec_helper'
2
+
3
+ module RubySpeech
4
+ module GRXML
5
+ describe Grammar do
6
+ it { should be_a_valid_grxml_document }
7
+
8
+ its(:name) { should == 'grammar' }
9
+ its(:language) { should == 'en-US' }
10
+
11
+ describe "setting options in initializers" do
12
+ subject { Grammar.new :language => 'jp', :base_uri => 'blah', :root => "main_rule", :tag_format => "semantics/1.0" }
13
+
14
+ its(:language) { should == 'jp' }
15
+ its(:base_uri) { should == 'blah' }
16
+ its(:root) { should == 'main_rule' }
17
+ its(:tag_format) { should == 'semantics/1.0' }
18
+ end
19
+
20
+ describe "setting dtmf mode" do
21
+ subject { Grammar.new :mode => 'dtmf' }
22
+ its(:mode) { should == :dtmf }
23
+ its(:dtmf?) { should be true }
24
+ its(:voice?) { should be false }
25
+ end
26
+
27
+ describe "setting voice mode" do
28
+ subject { Grammar.new :mode => 'voice' }
29
+ its(:mode) { should == :voice }
30
+ its(:voice?) { should be true }
31
+ its(:dtmf?) { should be false }
32
+ end
33
+
34
+ it 'registers itself' do
35
+ Element.class_from_registration(:grammar).should == Grammar
36
+ end
37
+
38
+ describe "from a document" do
39
+ let(:document) { '<grammar mode="dtmf" root="main_rule" version="1.0" xml:lang="jp" xml:base="blah"
40
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
41
+ xsi:schemaLocation="http://www.w3.org/2001/06/grammar
42
+ http://www.w3.org/TR/speech-grammar/grammar.xsd"
43
+ xmlns="http://www.w3.org/2001/06/grammar" />' }
44
+
45
+ subject { Element.import document }
46
+
47
+ it { should be_instance_of Grammar }
48
+
49
+ its(:language) { should == 'jp' }
50
+ its(:base_uri) { should == 'blah' }
51
+ its(:mode) { should == :dtmf }
52
+ its(:root) { should == 'main_rule' }
53
+ end
54
+
55
+ describe "#language" do
56
+ before { subject.language = 'jp' }
57
+
58
+ its(:language) { should == 'jp' }
59
+ end
60
+
61
+ describe "#base_uri" do
62
+ before { subject.base_uri = 'blah' }
63
+
64
+ its(:base_uri) { should == 'blah' }
65
+ end
66
+
67
+ describe "comparing objects" do
68
+ it "should be equal if the content, language and base uri are the same" do
69
+ Grammar.new(:language => 'en-GB', :base_uri => 'blah', :content => "Hello there").should == Grammar.new(:language => 'en-GB', :base_uri => 'blah', :content => "Hello there")
70
+ end
71
+
72
+ describe "when the content is different" do
73
+ it "should not be equal" do
74
+ Grammar.new(:content => "Hello").should_not == Grammar.new(:content => "Hello there")
75
+ end
76
+ end
77
+
78
+ describe "when the language is different" do
79
+ it "should not be equal" do
80
+ Grammar.new(:language => 'en-US').should_not == Grammar.new(:language => 'en-GB')
81
+ end
82
+ end
83
+
84
+ describe "when the base URI is different" do
85
+ it "should not be equal" do
86
+ Grammar.new(:base_uri => 'foo').should_not == Grammar.new(:base_uri => 'bar')
87
+ end
88
+ end
89
+
90
+ describe "when the children are different" do
91
+ it "should not be equal" do
92
+ g1 = Grammar.new
93
+ g1 << Rule.new(:id => 'main1')
94
+ g2 = Grammar.new
95
+ g2 << Rule.new(:id => 'main2')
96
+
97
+ g1.should_not == g2
98
+ end
99
+ end
100
+ end
101
+
102
+ it "should allow creating child GRXML elements" do
103
+ g = Grammar.new
104
+ g.Rule :id => :main, :scope => 'public'
105
+ expected_g = Grammar.new
106
+ expected_g << Rule.new(:id => :main, :scope => 'public')
107
+ g.should == expected_g
108
+ end
109
+
110
+ describe "<<" do
111
+ it "should accept Rule" do
112
+ lambda { subject << Rule.new }.should_not raise_error
113
+ end
114
+
115
+ it "should accept Tag" do
116
+ lambda { subject << Tag.new }.should_not raise_error
117
+ end
118
+
119
+ it "should raise InvalidChildError with non-acceptable objects" do
120
+ lambda { subject << 1 }.should raise_error(InvalidChildError, "A Grammar can only accept Rule and Tag as children")
121
+ end
122
+ end
123
+
124
+ describe "#to_doc" do
125
+ it "should create an XML document from the grammar" do
126
+ subject.to_doc.should == subject.document
127
+ end
128
+ end
129
+
130
+ describe "#tag_format" do
131
+ it "should allow setting tag-format identifier" do
132
+ lambda { subject.tag_format = "semantics/1.0" }.should_not raise_error
133
+ end
134
+ end
135
+
136
+ describe "concat" do
137
+ it "should allow concatenation" do
138
+ grammar1 = Grammar.new
139
+ grammar1 << Rule.new(:id => 'frank', :scope => 'public', :content => "Hi Frank")
140
+ grammar2 = Grammar.new
141
+ grammar2 << Rule.new(:id => 'millie', :scope => 'public', :content => "Hi Millie")
142
+
143
+ expected_concat = Grammar.new
144
+ expected_concat << Rule.new(:id => 'frank', :scope => 'public', :content => "Hi Frank")
145
+ expected_concat << Rule.new(:id => 'millie', :scope => 'public', :content => "Hi Millie")
146
+
147
+ concat = grammar1 + grammar2
148
+ concat.should == expected_concat
149
+ concat.to_s.should_not include('default')
150
+ end
151
+ end
152
+
153
+ it "should allow finding its root rule" do
154
+ grammar = GRXML::Grammar.new :root => 'foo'
155
+ bar = GRXML::Rule.new :id => 'bar'
156
+ grammar << bar
157
+ foo = GRXML::Rule.new :id => 'foo'
158
+ grammar << foo
159
+
160
+ grammar.root_rule.should == foo
161
+ end
162
+
163
+ describe "inlining rule references" do
164
+ let :grammar do
165
+ GRXML.draw :root => 'pin', :mode => :dtmf do
166
+ rule :id => 'digits' do
167
+ one_of do
168
+ 0.upto(9) { |d| item { d.to_s } }
169
+ end
170
+ end
171
+
172
+ rule :id => 'pin', :scope => 'public' do
173
+ one_of do
174
+ item do
175
+ item :repeat => '4' do
176
+ ruleref :uri => '#digits'
177
+ end
178
+ "#"
179
+ end
180
+ item do
181
+ "* 9"
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+
188
+ let :inline_grammar do
189
+ GRXML.draw :root => 'pin', :mode => :dtmf do
190
+ rule :id => 'pin', :scope => 'public' do
191
+ one_of do
192
+ item do
193
+ item :repeat => '4' do
194
+ one_of do
195
+ 0.upto(9) { |d| item { d.to_s } }
196
+ end
197
+ end
198
+ "#"
199
+ end
200
+ item do
201
+ "* 9"
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
207
+
208
+ it "should be possible in a non-destructive manner" do
209
+ grammar.inline.should == inline_grammar
210
+ grammar.should_not == inline_grammar
211
+ end
212
+
213
+ it "should be possible in a destructive manner" do
214
+ grammar.inline!.should == inline_grammar
215
+ grammar.should == inline_grammar
216
+ end
217
+ end
218
+
219
+ describe "#tokenize!" do
220
+ def single_rule_grammar(content = [])
221
+ GRXML.draw :root => 'm', :mode => :speech do
222
+ rule :id => 'm' do
223
+ Array(content).each { |e| embed e }
224
+ end
225
+ end
226
+ end
227
+
228
+ subject { single_rule_grammar content }
229
+
230
+ let(:tokenized_version) do
231
+ expected_tokens = Array(tokens).map do |s|
232
+ Token.new.tap { |t| t << s }
233
+ end
234
+ single_rule_grammar expected_tokens
235
+ end
236
+
237
+ before { subject.tokenize! }
238
+
239
+ context "with a single unquoted token" do
240
+ let(:content) { 'hello' }
241
+ let(:tokens) { 'hello' }
242
+
243
+ it "should tokenize correctly" do
244
+ should == tokenized_version
245
+ end
246
+ end
247
+
248
+ context "with a single unquoted token (non-alphabetic)" do
249
+ let(:content) { '2' }
250
+ let(:tokens) { ['2'] }
251
+
252
+ it "should tokenize correctly" do
253
+ should == tokenized_version
254
+ end
255
+ end
256
+
257
+ context "with a single quoted token (including whitespace)" do
258
+ let(:content) { '"San Francisco"' }
259
+ let(:tokens) { ['San Francisco'] }
260
+
261
+ it "should tokenize correctly" do
262
+ should == tokenized_version
263
+ end
264
+ end
265
+
266
+ context "with a single quoted token (no whitespace)" do
267
+ let(:content) { '"hello"' }
268
+ let(:tokens) { ['hello'] }
269
+
270
+ it "should tokenize correctly" do
271
+ should == tokenized_version
272
+ end
273
+ end
274
+
275
+ context "with two tokens delimited by white space" do
276
+ let(:content) { 'bon voyage' }
277
+ let(:tokens) { ['bon', 'voyage'] }
278
+
279
+ it "should tokenize correctly" do
280
+ should == tokenized_version
281
+ end
282
+ end
283
+
284
+ context "with four tokens delimited by white space" do
285
+ let(:content) { 'this is a test' }
286
+ let(:tokens) { ['this', 'is', 'a', 'test'] }
287
+
288
+ it "should tokenize correctly" do
289
+ should == tokenized_version
290
+ end
291
+ end
292
+
293
+ context "with a single XML token" do
294
+ let(:content) { [Token.new.tap { |t| t << 'San Francisco' }] }
295
+ let(:tokens) { ['San Francisco'] }
296
+
297
+ it "should tokenize correctly" do
298
+ should == tokenized_version
299
+ end
300
+ end
301
+
302
+ context "with a mixture of token types" do
303
+ let(:content) do
304
+ [
305
+ 'Welcome to "San Francisco"',
306
+ Token.new.tap { |t| t << 'Have Fun!' }
307
+ ]
308
+ end
309
+
310
+ let(:tokens) { ['Welcome', 'to', 'San Francisco', 'Have Fun!'] }
311
+
312
+ it "should tokenize correctly" do
313
+ should == tokenized_version
314
+ end
315
+ end
316
+ end
317
+
318
+ describe "#normalize_whitespace" do
319
+ it "should normalize whitespace in all of the tokens contained within it" do
320
+ grammar = GRXML.draw do
321
+ rule do
322
+ token { ' Welcome to ' }
323
+ token { ' San Francisco ' }
324
+ end
325
+ end
326
+
327
+ normalized_grammar = GRXML.draw do
328
+ rule do
329
+ token { 'Welcome to' }
330
+ token { 'San Francisco' }
331
+ end
332
+ end
333
+
334
+ grammar.should_not == normalized_grammar
335
+ grammar.normalize_whitespace
336
+ grammar.should == normalized_grammar
337
+ end
338
+ end
339
+ end # Grammar
340
+ end # GRXML
341
+ end # RubySpeech
@@ -0,0 +1,192 @@
1
+ require 'spec_helper'
2
+
3
+ module RubySpeech
4
+ module GRXML
5
+ describe Item do
6
+ subject { Item.new :weight => 1.1, :repeat => '1' }
7
+
8
+ its(:name) { should == 'item' }
9
+
10
+ its(:weight) { should == 1.1 }
11
+ its(:repeat) { should == 1 }
12
+
13
+ it 'registers itself' do
14
+ Element.class_from_registration(:item).should == Item
15
+ end
16
+
17
+ describe "everything from a document" do
18
+ let(:document) { '<item weight="1.1" repeat="1">one</item>' }
19
+
20
+ subject { Element.import document }
21
+
22
+ it { should be_instance_of Item }
23
+
24
+ its(:weight) { should == 1.1 }
25
+ its(:repeat) { should == 1 }
26
+ its(:content) { should == 'one' }
27
+ end
28
+
29
+ describe "#weight" do
30
+ context "from a document" do
31
+ subject { Element.import document }
32
+
33
+ describe "using .1" do
34
+ let(:document) { '<item weight=".1" repeat="1">one</item>' }
35
+ its(:weight) { should == 0.1 }
36
+ end
37
+
38
+ describe "using 1." do
39
+ let(:document) { '<item weight="1." repeat="1">one</item>' }
40
+ its(:weight) { should == 1.0 }
41
+ end
42
+
43
+ describe "using 1" do
44
+ let(:document) { '<item weight="1" repeat="1">one</item>' }
45
+ its(:weight) { should == 1.0 }
46
+ end
47
+ end
48
+
49
+ context "positive floating point numbers" do
50
+ before { subject.weight = 1.1 }
51
+
52
+ its(:weight) { should == 1.1 }
53
+
54
+ it "with valid value" do
55
+ lambda { subject.weight = 1 }.should_not raise_error
56
+ lambda { subject.weight = 1.0 }.should_not raise_error
57
+ lambda { subject.weight = 0.1 }.should_not raise_error
58
+ lambda { subject.weight = '.1' }.should_not raise_error
59
+ lambda { subject.weight = '1.' }.should_not raise_error
60
+ end
61
+
62
+ it "with an invalid value" do
63
+ lambda { subject.weight = 'one' }.should raise_error(ArgumentError, "A Item's weight attribute must be a positive floating point number")
64
+ lambda { subject.weight = -1 }.should raise_error(ArgumentError, "A Item's weight attribute must be a positive floating point number")
65
+ end
66
+ end
67
+ end
68
+
69
+ # Validate various values for repeat -- http://www.w3.org/TR/speech-grammar/#S2.5
70
+ describe "#repeat" do
71
+ context "exact" do
72
+ context "0" do
73
+ before { subject.repeat = 0 }
74
+ its(:repeat) { should == 0 }
75
+ end
76
+
77
+ context "5" do
78
+ before { subject.repeat = 5 }
79
+ its(:repeat) { should == 5 }
80
+ end
81
+
82
+ context "'1'" do
83
+ before { subject.repeat = '1' }
84
+ its(:repeat) { should == 1 }
85
+ end
86
+
87
+ it "invalid values" do
88
+ lambda { subject.repeat = -1 }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
89
+ lambda { subject.repeat = 'one' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
90
+ end
91
+ end
92
+
93
+ context "ranges" do
94
+ context "valid ranges from m to n" do
95
+ context "'1-5'" do
96
+ before { subject.repeat = '1-5' }
97
+ its(:repeat) { should == (1..5) }
98
+ end
99
+
100
+ context "'0-5'" do
101
+ before { subject.repeat = '0-5' }
102
+ its(:repeat) { should == (0..5) }
103
+ end
104
+
105
+ context "0..5" do
106
+ before { subject.repeat = 0..5 }
107
+ its(:repeat) { should == (0..5) }
108
+ end
109
+ end
110
+
111
+ it "illegal ranges from m to n" do
112
+ lambda { subject.repeat = '5-1' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
113
+ lambda { subject.repeat = '-1-2' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
114
+ lambda { subject.repeat = '1-2-3' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
115
+ lambda { subject.repeat = '1-B' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
116
+ lambda { subject.repeat = -1..2 }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
117
+ lambda { subject.repeat = 1..-2 }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
118
+ end
119
+
120
+ context "valid ranges of m or more" do
121
+ context "'3-'" do
122
+ before { subject.repeat = '3-' }
123
+ its(:repeat) { should == (3..Item::Inf) }
124
+ its(:repeat) { should include 10000 }
125
+ end
126
+
127
+ context "'0-'" do
128
+ before { subject.repeat = '0-' }
129
+ its(:repeat) { should == (0..Item::Inf) }
130
+ its(:repeat) { should include 10000 }
131
+ end
132
+ end
133
+
134
+ it "illegal ranges for m or more" do
135
+ lambda { subject.repeat = '-1-' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
136
+ lambda { subject.repeat = 'B-' }.should raise_error(ArgumentError, "A Item's repeat must be 0 or a positive integer")
137
+ end
138
+ end
139
+ end
140
+
141
+ # repeat probability (repeat-prob) -- http://www.w3.org/TR/speech-grammar/#S2.5.1
142
+ describe "#repeat_prob" do
143
+ it "should handle all valid values" do
144
+ lambda { subject.repeat_prob = 0 }.should_not raise_error
145
+ lambda { subject.repeat_prob = 1 }.should_not raise_error
146
+ lambda { subject.repeat_prob = 1.0 }.should_not raise_error
147
+ lambda { subject.repeat_prob = '1.' }.should_not raise_error
148
+ lambda { subject.repeat_prob = '1.0' }.should_not raise_error
149
+ lambda { subject.repeat_prob = '.5' }.should_not raise_error
150
+ end
151
+
152
+ it "should raise an error for invalid values" do
153
+ lambda { subject.repeat_prob = -1 }.should raise_error(ArgumentError, "A Item's repeat probablity attribute must be a floating point number between 0.0 and 1.0")
154
+ lambda { subject.repeat_prob = 1.5 }.should raise_error(ArgumentError, "A Item's repeat probablity attribute must be a floating point number between 0.0 and 1.0")
155
+ end
156
+ end
157
+
158
+ describe "#language" do
159
+ before { subject.language = 'jp' }
160
+
161
+ its(:language) { should == 'jp' }
162
+ end
163
+
164
+
165
+ describe "<<" do
166
+ it "should accept String" do
167
+ lambda { subject << 'anything' }.should_not raise_error
168
+ end
169
+
170
+ it "should accept OneOf" do
171
+ lambda { subject << OneOf.new }.should_not raise_error
172
+ end
173
+
174
+ it "should accept Item" do
175
+ lambda { subject << Item.new }.should_not raise_error
176
+ end
177
+
178
+ it "should accept Ruleref" do
179
+ lambda { subject << Ruleref.new }.should_not raise_error
180
+ end
181
+
182
+ it "should accept Tag" do
183
+ lambda { subject << Tag.new }.should_not raise_error
184
+ end
185
+
186
+ it "should accept Token" do
187
+ lambda { subject << Token.new }.should_not raise_error
188
+ end
189
+ end
190
+ end # Item
191
+ end # GRXML
192
+ end # RubySpeech
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ module RubySpeech
4
+ module GRXML
5
+ describe Match do
6
+ it_behaves_like "match"
7
+
8
+ describe "equality" do
9
+ it "should never be equal to a MaxMatch" do
10
+ described_class.new.should_not eql(MaxMatch.new)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end