spec/unit/parser_spec.rb in qcmd-0.1.13 vs spec/unit/parser_spec.rb in qcmd-0.1.14
- old
+ new
@@ -10,27 +10,26 @@
tokens = Qcmd::Parser.parse 'go "word word"'
tokens.should eql([:go, 'word word'])
end
it "should parse integers" do
- tokens = Qcmd::Parser.parse 'go "word word" 10 (rate 10)'
- tokens.should eql([:go, 'word word', 10, [:rate, 10]])
+ tokens = Qcmd::Parser.parse 'go "word word" 10 (rate 10) 1'
+ tokens.should eql([:go, 'word word', 10, [:rate, 10], 1])
end
it "should parse floats" do
- tokens = Qcmd::Parser.parse '1.1 go ("word word" 10.2 -12.3 1.1.1 10.2)'
- tokens.should eql([1.1, :go, ['word word', 10.2, -12.3, :'1.1.1', 10.2]])
+ tokens = Qcmd::Parser.parse '1.1 go ("word word" 10.2 -12.3 1.1.1) 10.2'
+ tokens.should eql([1.1, :go, ['word word', 10.2, -12.3, :'1.1.1'], 10.2])
end
it "should parse invalid numbers as symbols" do
tokens = Qcmd::Parser.parse 'cue 1.11.0'
tokens.should eql([:cue, :'1.11.0'])
end
it "should parse nested quotes" do
tokens = Qcmd::Parser.parse 'go "word word" 10 -12.3 "life \"is good\" yeah"'
-
tokens.should eql([:go, 'word word', 10, -12.3, 'life "is good" yeah'])
end
it "should parse nested commands" do
tokens = Qcmd::Parser.parse 'cue 10 name (cue 3 name)'
@@ -81,9 +80,8 @@
end
it "should handle escaped double quotes" do
expression = Qcmd::Parser.generate([:go, 'word word', 10, -12.3, 'life "is good" yeah'])
expression.should eql('(go "word word" 10 -12.3 "life \"is good\" yeah")')
-
end
end
end