From 859ba791447c3b133c36ee838501d6f9129f3bc0 Mon Sep 17 00:00:00 2001 From: Vlad Chepaykyn Date: Sat, 18 Nov 2023 01:50:37 +0300 Subject: [PATCH 1/3] fix: description tests --- test/description.jl | 95 ++++++++------------------------------------- 1 file changed, 17 insertions(+), 78 deletions(-) diff --git a/test/description.jl b/test/description.jl index bad4f41..ce00ce6 100644 --- a/test/description.jl +++ b/test/description.jl @@ -1,90 +1,29 @@ -# TODO: reimplement first line spacing in Julia -function remove_first_line(s::String) +function first_line(s::String) lines = split(s, '\n') - return join(lines[2:end], '\n') + return string(lines[1]) end -@testset "Treesitter" begin - doc = test_pandoc( - """ -Here's a YAML codeblock: +function check(expected::Regex, real::String) + if occursin(expected, real) == false + @test false + @error string(" Expected: ", expected) + @error string("Expression: ", string(real)) + end +end -```yaml -name: panvimdoc -on: [push] -jobs: - docs: - runs-on: ubuntu-latest - name: pandoc to vimdoc - steps: - - uses: actions/checkout@v2 -``` - """; +@testset "Description" begin + doc = test_pandoc( + """Some readme information."""; 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) + expected_pattern = Regex("\\*test.txt\\* +For NVIM v0.8.0 +Last change: " * CURRENT_DATE) + check(expected_pattern, 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 -``` - """; + """Some readme information."""; 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: -""") + expected_pattern = Regex("\\*test.txt\\* +For VIM v9.0.0 +Last change: " * CURRENT_DATE) + check(expected_pattern, first_line(doc)) end From 05866e57493b4ef605ac9843be61ccfb4929796c Mon Sep 17 00:00:00 2001 From: Vlad Chepaykyn Date: Sat, 18 Nov 2023 02:28:30 +0300 Subject: [PATCH 2/3] update: show dots when description tests are successful --- test/description.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/description.jl b/test/description.jl index ce00ce6..4ab6c06 100644 --- a/test/description.jl +++ b/test/description.jl @@ -4,7 +4,9 @@ function first_line(s::String) end function check(expected::Regex, real::String) - if occursin(expected, real) == false + if occursin(expected, real) + @test true + else @test false @error string(" Expected: ", expected) @error string("Expression: ", string(real)) From 7c967209e1195593ac0423bd6986e451b49a93d4 Mon Sep 17 00:00:00 2001 From: Vlad Chepaykyn Date: Sat, 18 Nov 2023 02:37:53 +0300 Subject: [PATCH 3/3] update: description.jl -> title.jl --- test/{description.jl => title.jl} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename test/{description.jl => title.jl} (96%) diff --git a/test/description.jl b/test/title.jl similarity index 96% rename from test/description.jl rename to test/title.jl index 4ab6c06..52f3306 100644 --- a/test/description.jl +++ b/test/title.jl @@ -13,7 +13,7 @@ function check(expected::Regex, real::String) end end -@testset "Description" begin +@testset "Title" begin doc = test_pandoc( """Some readme information."""; description = nothing,