jsgf 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/jsgf.gemspec +1 -1
- data/lib/jsgf/grammar.rb +1 -1
- data/test/jsgf/grammar.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5f37d8d1978f31b192515183e6be841c83f4dc4
|
4
|
+
data.tar.gz: 3179b3009527599016cafec61255e4d38003f841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d0b2333de1dd3ee537f091b79fe4aaa44eec199528c14af461a328fbd009ee5f5976187bfc6c7a6a3d077c41d8bedaaf782760d653bec7503bd3e89196beaf
|
7
|
+
data.tar.gz: f9f966bd54797f0aa5e49fbe60b5ebd015d9dc9ea3f755ea2053add15a6a83fe2910a2231875309b8409a58750ce8d0d77d6142931f16984b8697cfb55f1f5b5
|
data/README.md
CHANGED
data/jsgf.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "jsgf"
|
7
|
-
spec.version = '0.2'
|
7
|
+
spec.version = '0.2.1'
|
8
8
|
spec.authors = ["Brandon Fosdick"]
|
9
9
|
spec.email = ["bfoz@bfoz.net"]
|
10
10
|
spec.summary = %q{Java Speech Grammar Format}
|
data/lib/jsgf/grammar.rb
CHANGED
data/test/jsgf/grammar.rb
CHANGED
@@ -4,63 +4,63 @@ require 'jsgf/parser'
|
|
4
4
|
describe JSGF::Grammar do
|
5
5
|
it 'must unparse a header' do
|
6
6
|
grammar = JSGF::Parser.new('#JSGF; grammar header_grammar;').parse
|
7
|
-
grammar.to_s.must_equal
|
7
|
+
grammar.to_s.must_equal "#JSGF;\ngrammar header_grammar;"
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'must unparse a header with a version' do
|
11
11
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;').parse
|
12
|
-
grammar.to_s.must_equal
|
12
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;"
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'must unparse a header with a version and a character encoding' do
|
16
16
|
grammar = JSGF::Parser.new('#JSGF V1.0 ENCODING; grammar header_grammar;').parse
|
17
|
-
grammar.to_s.must_equal
|
17
|
+
grammar.to_s.must_equal "#JSGF V1.0 ENCODING;\ngrammar header_grammar;"
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'must unparse a simple rule' do
|
21
21
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=one;').parse
|
22
|
-
grammar.to_s.must_equal
|
22
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = one;"
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'must unparse a public rule' do
|
26
26
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;public <rule>=one;').parse
|
27
|
-
grammar.to_s.must_equal
|
27
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\npublic <rule> = one;"
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'must unparse a multi-atom rule' do
|
31
31
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=one two;').parse
|
32
|
-
grammar.to_s.must_equal
|
32
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = one two;"
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'must unparse a multi-atom optional' do
|
36
36
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=[one two];').parse
|
37
|
-
grammar.to_s.must_equal
|
37
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = [one two];"
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'must unparse an alternation' do
|
41
41
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=one | two;').parse
|
42
|
-
grammar.to_s.must_equal
|
42
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = one | two;"
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'must unparse an optional alternation' do
|
46
46
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=[one | two];').parse
|
47
|
-
grammar.to_s.must_equal
|
47
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = [one | two];"
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'must unparse an alternation with a nested group' do
|
51
51
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=(one two) | three;').parse
|
52
|
-
grammar.to_s.must_equal
|
52
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = (one two) | three;"
|
53
53
|
end
|
54
54
|
|
55
55
|
describe 'when unparsing rule references' do
|
56
56
|
it 'must unparse a rule reference' do
|
57
57
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>=(one <rule2>) | three; <rule2>=two;').parse
|
58
|
-
grammar.to_s.must_equal
|
58
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = (one <rule2>) | three;\n<rule2> = two;"
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'must unparse a weighted rule reference' do
|
62
62
|
grammar = JSGF::Parser.new('#JSGF V1.0; grammar header_grammar;<rule>= /0.5/ one | /0.5/ <rule2>; <rule2>=two;').parse
|
63
|
-
grammar.to_s.must_equal
|
63
|
+
grammar.to_s.must_equal "#JSGF V1.0;\ngrammar header_grammar;\n<rule> = /0.5/ one | /0.5/ <rule2>;\n<rule2> = two;"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|