summaryrefslogtreecommitdiff
path: root/test/parser/isupport_test.exs
blob: e8185b73f1ce83f7d6adc7ccc4ba849063acfd41 (plain) (blame)
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
defmodule Irc.Parser.IsupportTest do
  use ExUnit.Case
  alias Irc.Parser.Isupport
  doctest Irc.Parser.Isupport

  test "flag" do
    assert Isupport.parse(["WHOX"]) == %{"WHOX" => true}
  end

  test "k-v" do
    assert Isupport.parse(["HELLO=WORLD"]) == %{"HELLO" => "WORLD"}
  end

  test "k-v, integer value" do
    assert Isupport.parse(["RESPONSE=42"]) == %{"RESPONSE" => 42}
  end

  test "key with multiple values" do
    assert Isupport.parse(["TARGMAX=NAMES:1,MONITOR:,NOTICE:4"]) == %{
      "TARGMAX" => %{
        "NAMES" => 1,
        "MONITOR" => "",
        "NOTICE" => 4
      }
    }
  end

  test "PREFIX" do
    assert Isupport.parse(["PREFIX=(ovh)@+%"]) == %{
      "PREFIX" => %{
        "%" => "h", "+" => "v", "@" => "o"
      }
    }
  end

end