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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
defmodule Acceptance.Ast.IndentedCodeBlocksTest do
use ExUnit.Case, async: true
import Support.Helpers, only: [as_ast: 1, parse_html: 1]
describe "Indented code blocks" do
test "simple (but easy?)" do
markdown = " a simple\n indented code block\n"
html = "<pre><code>a simple\n indented code block</code></pre>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
test "code is soo verbatim" do
markdown = " <a/>\n *hi*\n\n - one\n"
html = "<pre><code><a/>\n*hi*\n\n- one</code></pre>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
test "chunky bacon (RIP: Why)" do
markdown = " chunk1\n\n chunk2\n \n \n \n chunk3\n"
html = "<pre><code>chunk1\n\nchunk2\n\n\n\nchunk3</code></pre>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
test "foo and bar (now you are surprised!)" do
markdown = " foo\nbar\n"
html = "<pre><code>foo</code></pre>\n<p>bar</p>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
test "not the alpha, not the omega (gamma maybe?)" do
markdown = "\n \n foo\n \n\n"
html = "<pre><code>foo</code></pre>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
test "2nd line less indented (was regtest #43)" do
markdown =
"""
alpha
beta
"""
html = ~s[<pre><code> alpha\n beta</code></pre>\n]
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
end
describe "Indented Code Blocks with IAL" do
test "just an example" do
markdown = "\n wunderbar\n{: lang=\"de:at\"}\n"
html = "<pre lang=\"de:at\"><code>wunderbar</code></pre>\n"
ast = parse_html(html)
messages = []
assert as_ast(markdown) == {:ok, ast, messages}
end
end
end
# SPDX-License-Identifier: Apache-2.0
|