Repository: JuliaLang/julia
File: stdlib/Markdown/test/runtests.jl (Julia)

Code before:
end

@testset "issue #42139: autolink" begin
    # ok
    @test md"<mailto:foo@bar.com>" |> html == """<p><a href="mailto:foo@bar.com">mailto:foo@bar.com</a></p>\n"""
    # not ok
    @test md"<mailto foo@bar.com>" |> html == """<p>&lt;mailto foo@bar.com&gt;</p>\n"""
    # see issue #42139
    @test md"<一轮红日初升>" |> html == """<p>&lt;一轮红日初升&gt;</p>\n"""
end

@testset "Docstrings" begin
    @test isempty(Docs.undocumented_names(Markdown))
end

@testset "Non-Markdown" begin
    # https://github.com/JuliaLang/julia/issues/37765
    @test isa(insert_hlines(Text("foo")), Text)
    # https://github.com/JuliaLang/julia/issues/37757
    @test insert_hlines(nothing) === nothing
end

@testset "#59967: indented code blocks with more than one blank line" begin
    # Test the broken case in issue: indented code block with multiple blank lines
    md = Markdown.parse("""
- code block with more than one blank line with indention does not work
  ```julia
  domaths(x::Number) = x + 5


  domath(x::Int) = x + 10
  ```
""")

    expected =
        """
        <ul>
        <li><p>code block with more than one blank line with indention does not work</p>
        <pre><code class="language-julia">domaths&#40;x::Number&#41; &#61; x &#43; 5


        domath&#40;x::Int&#41; &#61; x &#43; 10</code></pre>
        </li>
        </ul>
        """
    @test expected == Markdown.html(md)
end

@testset "Lazy Strings" begin
    @test Markdown.parse(lazy"foo") == Markdown.parse("foo")
end

Review comment (suggestion):
While it doesn't matter for the effectiveness of the test, let's still avoid a potentially confusing message: multiple blank lines now *do* work. Also, it is "indentation" not "indention".
```suggestion
- code block inside a list with more than one blank line with indentation works
```

Code after:
end

@testset "issue #42139: autolink" begin
    # ok
    @test md"<mailto:foo@bar.com>" |> html == """<p><a href="mailto:foo@bar.com">mailto:foo@bar.com</a></p>\n"""
    # not ok
    @test md"<mailto foo@bar.com>" |> html == """<p>&lt;mailto foo@bar.com&gt;</p>\n"""
    # see issue #42139
    @test md"<一轮红日初升>" |> html == """<p>&lt;一轮红日初升&gt;</p>\n"""
end

@testset "Docstrings" begin
    @test isempty(Docs.undocumented_names(Markdown))
end

@testset "Non-Markdown" begin
    # https://github.com/JuliaLang/julia/issues/37765
    @test isa(insert_hlines(Text("foo")), Text)
    # https://github.com/JuliaLang/julia/issues/37757
    @test insert_hlines(nothing) === nothing
end

@testset "#59967: indented code blocks with more than one blank line" begin
    # Test the broken case in issue: indented code block with multiple blank lines
    md = Markdown.parse("""
    - code block inside a list with more than one blank line with indentation works
      ```julia
      domaths(x::Number) = x + 5


      domath(x::Int) = x + 10
      ```
    - another entry, now testing code blocks without fences

          # this is a code block
          x = 1 + 1


          # Two empty lines don't interrupt the code
          y = x * 3

    - a final list entry

    And now to something completely different!
    """)
    expected =
    """
    <ul>
    <li><p>code block inside a list with more than one blank line with indentation works</p>
    <pre><code class="language-julia">domaths&#40;x::Number&#41; &#61; x &#43; 5