File: single_conversion_test.exs

package info (click to toggle)
elixir-earmark-parser 1.4.44-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,148 kB
  • sloc: makefile: 9
file content (39 lines) | stat: -rw-r--r-- 959 bytes parent folder | download
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 Test.Functional.Inline.Converter.SingleConversionTest do
  use Support.InlineConverterCase

  describe "autolinks:" do
    test "autolink, http" do
      assert convert("<http:/mysite>") == [{"a", [{"href", "http:/mysite"}], ["http:/mysite"], %{}}]
    end

    test "autolink, mailto" do
      assert convert("<http@mysite>") == [{"a", [{"href", "mailto:http@mysite"}], ["http@mysite"], %{}}]
    end
  end

  describe "escape:" do
    test "escape" do
      assert convert("a\\_b") == ~W[a_b]
    end

    test "escape at beginning" do
      assert convert("\\_b") == ~W[_b]
    end

    test "escape an escape" do
      assert convert("a\\\\_b") == ~W[a\_b]
    end
  end

  describe "simple tags" do
    test "strikethrough" do
      assert convert("~~alpha~~") == [{"del", [], ["alpha"], %{}}]
    end

    test "no strikethrough" do
      assert convert("~~ alpha~~") == ["~~ alpha~~"]
    end
  end
end

# SPDX-License-Identifier: Apache-2.0