Accept prompt in parser
parent
3c677b7d29
commit
885ac26cd1
|
@ -12,7 +12,8 @@ module Biju
|
|||
rule(:prefix) { str('AT') | str('at') }
|
||||
|
||||
# RESPONSE
|
||||
rule(:response) { cr >> crlf >> (status | command) >> crlf }
|
||||
rule(:response) { cr >> crlf >> (((status | command) >> crlf) | prompt) }
|
||||
rule(:prompt) { str('> ') }
|
||||
rule(:command) { mgl | pms | mgf | mserror }
|
||||
|
||||
rule(:mserror) { str('+CMS ERROR').as(:cmd) >> str(': ') >> message }
|
||||
|
|
|
@ -15,6 +15,13 @@ describe Biju::ATParser do
|
|||
end
|
||||
|
||||
context "response" do
|
||||
it "parses cmgs prompt" do
|
||||
mgs = "AT+CMGS=18\r\r\n> "
|
||||
|
||||
expect { Biju::ATTransform.new.apply(
|
||||
Biju::ATParser.new.parse(mgs)) }.not_to raise_error
|
||||
end
|
||||
|
||||
it "parses messages list" do
|
||||
messages = "AT+CMGL=1\r\r\n" <<
|
||||
"+CMGL: 0,1,,23\r\n" <<
|
||||
|
|
Loading…
Reference in New Issue