1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
defmodule Irc.Parser.PrefixTest do
use ExUnit.Case
alias Irc.Parser.Prefix
doctest Irc.Parser.Prefix
@conn %Irc.Connection{isupport: %{"PREFIX" => %{"@" => "o", "+" => "v"}}}
test "who flags (lax)" do
assert Prefix.parse("H*@", @conn, true) == {["o"], "H*"}
end
test "lax, multiple" do
assert Prefix.parse("H*@+", @conn, true) == {["o", "v"], "H*"}
assert Prefix.parse("H*@+", @conn) == {[], "H*@+"}
end
test "not lax" do
assert Prefix.parse("@href", @conn) == {["o"], "href"}
end
test "not lax, multiple" do
assert Prefix.parse("@+href", @conn) == {["o", "v"], "href"}
end
test "not lax, prefix char in rest" do
assert Prefix.parse("@hr@f", @conn) == {["o"], "hr@f"}
end
test "no prefix, not lax" do
assert Prefix.parse("href", @conn) == {[], "href"}
end
test "no prefix, lax" do
assert Prefix.parse("href", @conn, true) == {[], "href"}
end
end
|