0a2894f07a
When a text token was running, it wouldn't stop on a $-sign if it wasn't followed with a "[". This is good. But when a token was finished and the next char was a $-sign, it would consider it an MFMOpen, even when not followed by a "[". This is now fixed.
24 lines
608 B
Elixir
24 lines
608 B
Elixir
defmodule MfmParser.ReaderTest do
|
|
use ExUnit.Case
|
|
alias MfmParser.Reader
|
|
|
|
test "it can peek at the next character" do
|
|
assert Reader.peek("chocolatine") == "c"
|
|
end
|
|
|
|
test "it can peek at the nth character" do
|
|
assert Reader.peek("chocolatine", 7) == "a"
|
|
end
|
|
|
|
test "it step to the next character" do
|
|
assert Reader.next("chocolatine") == {"c", "hocolatine"}
|
|
end
|
|
|
|
test "it returns eof" do
|
|
assert Reader.peek("") == :eof
|
|
assert Reader.peek("", 1) == :eof
|
|
assert Reader.peek("", 2) == :eof
|
|
assert Reader.peek("c", 3) == :eof
|
|
assert Reader.next("") == :eof
|
|
end
|
|
end
|