Add Vader tests for RSS feed generation

This commit is contained in:
Reiner Herrmann 2020-07-22 15:33:21 +02:00 committed by Tinmarino
parent e3501dcdd0
commit ca84701c83
6 changed files with 137 additions and 0 deletions

110
test/diary_rss_feed.vader Normal file
View File

@ -0,0 +1,110 @@
Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
Given (Void):
Execute (Generate HTML and RSS feed):
edit $HOME/testwiki/index.wiki
Vimwiki2HTML
VimwikiRss
Given (Void):
Do (Get HTML file):
:read $HOME/html/default/index.html\<CR>
# Go to line with RSS link
gg/RSS\<CR>
# Delete everything above
kdgg
# Delete everything below
jdG
# Save (Not necessary)
:write
Expect (RSS link in HTML):
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
Do (Get RSS feed):
:read $HOME/html/default/rss.xml\<CR>
# Remove first line
ggdd
# Replace pubDate with dummy as it's based on file modification time
:%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
# Save (Not necessary)
:write
Expect (RSS):
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Diary</title>
<link>https://example.com/diary/diary.html</link>
<description>Diary</description>
<pubDate>...</pubDate>
<atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
<item>
<title>day 4</title>
<link>https://example.com/diary/2020-07-25.html</link>
<guid isPermaLink="false">2020-07-25</guid>
<description><![CDATA[
<div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
<div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
<p>
here is some code:
</p>
<pre>
#!/bin/sh
echo "hello world"
</pre>
<div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
<p>
an important list:
</p>
<ul>
<li>
point 1
<li>
point 2
</ul>
]]></description>
<pubDate>...</pubDate>
</item>
<item>
<title>Day 2</title>
<link>https://example.com/diary/2020-07-23.html</link>
<guid isPermaLink="false">2020-07-23</guid>
<description><![CDATA[
<div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
<p>
another diary entry
</p>
]]></description>
<pubDate>...</pubDate>
</item>
<item>
<title>2020-07-22</title>
<link>https://example.com/diary/2020-07-22.html</link>
<guid isPermaLink="false">2020-07-22</guid>
<description><![CDATA[
<p>
example diary entry for day 1.
</p>
]]></description>
<pubDate>...</pubDate>
</item>
</channel>
</rss>
Include: vader_includes/vader_teardown.vader

View File

@ -0,0 +1 @@
example diary entry for day 1.

View File

@ -0,0 +1,3 @@
= Day 2 =
another diary entry

View File

@ -0,0 +1,5 @@
%nohtml
== day 3 ==
and yet *another* diary entry.

View File

@ -0,0 +1,17 @@
= day 4 =
== subsection 1 ==
here is some code:
{{{
#!/bin/sh
echo "hello world"
}}}
== subsection 2 ==
an important list:
* point 1
* point 2

View File

@ -19,6 +19,7 @@ let vimwiki_default.path_html = $HOME . '/html/default'
let vimwiki_default.syntax = 'default'
let vimwiki_default.ext = '.wiki'
let vimwiki_default.name = 'DefaultSyntax'
let vimwiki_default.base_url = 'https://example.com/'
" markdown syntax - https://github.github.com/gfm/
let vimwiki_markdown = {}