Skip to content

Commit

Permalink
chore: support charlist sigil in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mnishiguchi authored and fhunleth committed Jun 10, 2023
1 parent bc66d20 commit dc75bb8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/vintage_net_mobile/at_parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ defmodule VintageNetMobile.ATParserTest do

test "errors on corrupt notifications" do
# Missing colon
assert {:error, "Parse error {:illegal, '+CSQ '} for \"+CSQ 5,99\"}"} ==
assert {:error, "Parse error {:illegal, #{inspect(~c"+CSQ ")}} for \"+CSQ 5,99\"}"} ==
ATParser.parse("+CSQ 5,99")

# Missing header
Expand All @@ -63,15 +63,16 @@ defmodule VintageNetMobile.ATParserTest do
assert {:error, "Expecting string to start with '+XYZ: ', but got \"\""} == ATParser.parse("")

# Bad integer value
assert {:error, "Parse error {:illegal, 'A'} for \"+CSQ: 5A,99\"}"} ==
assert {:error, "Parse error {:illegal, #{inspect(~c"A")}} for \"+CSQ: 5A,99\"}"} ==
ATParser.parse("+CSQ: 5A,99")

# Bad hex value
assert {:error, "Parse error {:illegal, 'z'} for \"+CSQ: 0x12aAz,99\"}"} ==
assert {:error, "Parse error {:illegal, #{inspect(~c"z")}} for \"+CSQ: 0x12aAz,99\"}"} ==
ATParser.parse("+CSQ: 0x12aAz,99")

# Missing close quote
assert {:error, "Parse error {:illegal, '\"Missing quote'} for \"+CSQ: \\\"Missing quote\"}"} ==
assert {:error,
"Parse error {:illegal, #{inspect(~c"\"Missing quote")}} for \"+CSQ: \\\"Missing quote\"}"} ==
ATParser.parse("+CSQ: \"Missing quote")
end
end

0 comments on commit dc75bb8

Please sign in to comment.