diff --git a/test/description.jl b/test/description.jl deleted file mode 100644 index bad4f41..0000000 --- a/test/description.jl +++ /dev/null @@ -1,90 +0,0 @@ -# TODO: reimplement first line spacing in Julia -function remove_first_line(s::String) - lines = split(s, '\n') - return join(lines[2:end], '\n') -end - -@testset "Treesitter" begin - doc = test_pandoc( - """ -Here's a YAML codeblock: - -```yaml -name: panvimdoc -on: [push] -jobs: - docs: - runs-on: ubuntu-latest - name: pandoc to vimdoc - steps: - - uses: actions/checkout@v2 -``` - """; - description = nothing, - ) - @test remove_first_line(""" -*test.txt* For NVIM v0.8.0 Last change: $(CURRENT_DATE) - -============================================================================== -Table of Contents *test-table-of-contents* - -Here’s a YAML codeblock: - ->yaml - name: panvimdoc - on: [push] - jobs: - docs: - runs-on: ubuntu-latest - name: pandoc to vimdoc - steps: - - uses: actions/checkout@v2 -< - -Generated by panvimdoc - -vim:tw=78:ts=8:noet:ft=help:norl: -""") == remove_first_line(doc) - - doc = test_pandoc( - """ -Here's a YAML codeblock: - -```yaml -name: panvimdoc -on: [push] -jobs: - docs: - runs-on: ubuntu-latest - name: pandoc to vimdoc - steps: - - uses: actions/checkout@v2 -``` - """; - vimversion = "VIM v9.0.0", - description = nothing, - ) - @test remove_first_line(doc) == remove_first_line(""" -*test.txt* For VIM v9.0.0 Last change: $(CURRENT_DATE) - -============================================================================== -Table of Contents *test-table-of-contents* - -Here’s a YAML codeblock: - ->yaml - name: panvimdoc - on: [push] - jobs: - docs: - runs-on: ubuntu-latest - name: pandoc to vimdoc - steps: - - uses: actions/checkout@v2 -< - -Generated by panvimdoc - -vim:tw=78:ts=8:noet:ft=help:norl: -""") -end diff --git a/test/title.jl b/test/title.jl new file mode 100644 index 0000000..52f3306 --- /dev/null +++ b/test/title.jl @@ -0,0 +1,31 @@ +function first_line(s::String) + lines = split(s, '\n') + return string(lines[1]) +end + +function check(expected::Regex, real::String) + if occursin(expected, real) + @test true + else + @test false + @error string(" Expected: ", expected) + @error string("Expression: ", string(real)) + end +end + +@testset "Title" begin + doc = test_pandoc( + """Some readme information."""; + description = nothing, + ) + expected_pattern = Regex("\\*test.txt\\* +For NVIM v0.8.0 +Last change: " * CURRENT_DATE) + check(expected_pattern, first_line(doc)) + + doc = test_pandoc( + """Some readme information."""; + vimversion = "VIM v9.0.0", + description = nothing, + ) + expected_pattern = Regex("\\*test.txt\\* +For VIM v9.0.0 +Last change: " * CURRENT_DATE) + check(expected_pattern, first_line(doc)) +end