File: comment_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 (58 lines) | stat: -rw-r--r-- 1,408 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
defmodule Acceptance.Ast.CommentTest do
  use ExUnit.Case, async: true

  import Support.Helpers, only: [as_ast: 1]

  describe "HTML Comments" do
    test "one line" do
      markdown = "<!-- Hello -->"
      ast = {:comment, [], [" Hello "], %{comment: true}}
      messages = []

      assert as_ast(markdown) == {:ok, [ast], messages}
    end

    test "more lines" do
      markdown = "<!-- Hello\n World-->"
      ast = {:comment, [], [" Hello", " World"], %{comment: true}}
      messages = []

      assert as_ast(markdown) == {:ok, [ast], messages}
    end

    test "what about the closing" do
      markdown = "<!-- Hello\n World -->garbish"
      ast = {:comment, [], [" Hello", " World "], %{comment: true}}
      messages = []

      assert as_ast(markdown) == {:ok, [ast], messages}
    end

    test "what about the fenced closing" do
      markdown = """
      <!-- Hello
      ```elixir
       World --> garbish
      """

      ast = {:comment, [], [" Hello", "```elixir", " World "], %{comment: true}}
      messages = []

      assert as_ast(markdown) == {:ok, [ast], messages}
    end

    test "fence at the end" do
      markdown = """
      <!-- Hello
      ```elixir
      """

      ast = {:comment, [], [" Hello", "```elixir"], %{comment: true}}
      messages = []

      assert as_ast(markdown) == {:ok, [ast], messages}
    end
  end
end

# SPDX-License-Identifier: Apache-2.0