Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Fix the unit tests.
Browse files Browse the repository at this point in the history
(Not like anyone ever runs them...)

`make check` will now backup config.xml and replace it with config.xml.check,
so that when running lb.exe we'll get a consistent config.xml file (as changes
to config.xml cause changes to the test output, which defeats the purpose of
testing the output...).

Once `make check` finishes, we replace config.xml with the original contents.

svn path=/trunk/lb/; revision=149186
  • Loading branch information
Jonathan Pryor committed Jan 7, 2010
1 parent f56b535 commit 7f37300
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 117 deletions.
17 changes: 17 additions & 0 deletions config.xml.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<config
Author="Jonathan Pryor (jonpryor@vt.edu)"
BlogDirectory="/home/test/blog"
BlogFileName="index.html"
BlogWebDirectory="http://www.example.com/Blog/"
BlogImageBasedir="http://www.example.com"
Copyright="Test Copyright Owner"
Description="Test web log"
ManagingEditor="test@example.com"
Title="Test web log"
RSSFileName="test"
BlogTemplate="template"
EntryTemplate="entry"
InputEncoding="utf-8"
OutputEncoding="utf-8"
/>
9 changes: 8 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ push: b
$(REMOTE_DIRECTORY)

check-update:
-rm -Rf test/out
-mv config.xml ._config.xml
cp config.xml.check config.xml
mono --debug lb.exe --blog-directory=`pwd`/test/in --prefix=test/out \
--blog-template=template.test --entry-template=entry.test \
--rss-filename=test
-rm config.xml
-mv ._config.xml config.xml

check:
-rm -Rf test/tmp
-mv config.xml ._config.xml
cp config.xml.check config.xml
mono --debug lb.exe --blog-directory=`pwd`/test/in --prefix=test/tmp \
--blog-template=template.test --entry-template=entry.test \
--rss-filename=test
diff -ru --exclude=\.svn test/out test/tmp
-rm config.xml
-mv ._config.xml config.xml

26 changes: 13 additions & 13 deletions test/out/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en">
<head>
<title>Jonathan Pryor's web log</title>
<title>Test web log</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" title="default">
@import '../styles.css';
Expand All @@ -13,10 +13,10 @@ <h1>Lame Blog Test Template</h1>
<h2>Simple Substitutions:</h2>
<dl>
<dt>@BASEDIR@:</dt><dd></dd>
<dt>@DESCRIPTION@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@EDITOR@:</dt><dd>jonpryor@vt.edu</dd>
<dt>@DESCRIPTION@:</dt><dd>Test web log</dd>
<dt>@EDITOR@:</dt><dd>test@example.com</dd>
<dt>@RSSFILENAME@:</dt><dd>test</dd>
<dt>@TITLE@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@TITLE@:</dt><dd>Test web log</dd>
</dl>
<h2>Complex Substitutions:</h2>
<h3>@BLOG_ENTRY_INDEX@:</h3>
Expand All @@ -30,18 +30,18 @@ <h3>@BLOG_ENTRY_INDEX@:</h3>
<h3>@BLOG_ENTRIES@:</h3>
<blockquote>
<p></p>
<h2 id="entry-2005-07-20T02:48:00PM" name="">@ENTRY_CAPTION</h2>
<h2 id="entry-2005-07-20T02:48:00PM" name="<a name="7-2f20-2f2005-2-3a48-3a00-PM"></a>">@ENTRY_CAPTION</h2>
<p>This is a test entry. This is only a test.</p>

<hr>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd></dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dd><a name="7-2f20-2f2005-2-3a48-3a00-PM"></a></dd>
<dt>@ENTRY_CAPTION@:</dt>
<dd>This is a title</dd>
<dt>@ENTRY_CATEGORY@:</dt>
Expand All @@ -61,11 +61,11 @@ <h2 id="entry-2005-07-20T02:48:00PM" name="">@ENTRY_CAPTION</h2>
</dl>

<p></p>
<h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="<a name="7-2f14-2f2005-2-3a49-3a00-PM"></a>">@ENTRY_CAPTION</h2>
<p>@ENTRY_PATH@=archive/foo/bar/2005/</p>
<p>Testing...
This needs to work.
@import '../syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
Expand All @@ -86,11 +86,11 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd></dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dd><a name="7-2f14-2f2005-2-3a49-3a00-PM"></a></dd>
<dt>@ENTRY_CAPTION@:</dt>
<dd>This is a Mono.Posix title</dd>
<dt>@ENTRY_CATEGORY@:</dt>
Expand Down
12 changes: 6 additions & 6 deletions test/out/archive/2005/Jul-20.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en">
<head>
<title>This is a title - Jonathan Pryor's web log</title>
<title>This is a title - Test web log</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" title="default">
@import '../../../styles.css';
Expand All @@ -13,10 +13,10 @@ <h1>Lame Blog Test Template</h1>
<h2>Simple Substitutions:</h2>
<dl>
<dt>@BASEDIR@:</dt><dd>../../</dd>
<dt>@DESCRIPTION@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@EDITOR@:</dt><dd>jonpryor@vt.edu</dd>
<dt>@DESCRIPTION@:</dt><dd>Test web log</dd>
<dt>@EDITOR@:</dt><dd>test@example.com</dd>
<dt>@RSSFILENAME@:</dt><dd>test</dd>
<dt>@TITLE@:</dt><dd>This is a title - Jonathan Pryor's web log</dd>
<dt>@TITLE@:</dt><dd>This is a title - Test web log</dd>
</dl>
<h2>Complex Substitutions:</h2>
<h3>@BLOG_ENTRY_INDEX@:</h3>
Expand All @@ -38,9 +38,9 @@ <h2 id="entry-2005-07-20T02:48:00PM" name="">@ENTRY_CAPTION</h2>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd>../../</dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dt>@ENTRY_CAPTION@:</dt>
Expand Down
14 changes: 7 additions & 7 deletions test/out/archive/foo/bar/2005/Jul-14.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en">
<head>
<title>This is a Mono.Posix title - Jonathan Pryor's web log</title>
<title>This is a Mono.Posix title - Test web log</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" title="default">
@import '../../../../../styles.css';
Expand All @@ -13,10 +13,10 @@ <h1>Lame Blog Test Template</h1>
<h2>Simple Substitutions:</h2>
<dl>
<dt>@BASEDIR@:</dt><dd>../../../../</dd>
<dt>@DESCRIPTION@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@EDITOR@:</dt><dd>jonpryor@vt.edu</dd>
<dt>@DESCRIPTION@:</dt><dd>Test web log</dd>
<dt>@EDITOR@:</dt><dd>test@example.com</dd>
<dt>@RSSFILENAME@:</dt><dd>test</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Jonathan Pryor's web log</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Test web log</dd>
</dl>
<h2>Complex Substitutions:</h2>
<h3>@BLOG_ENTRY_INDEX@:</h3>
Expand All @@ -35,7 +35,7 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>@ENTRY_PATH@=../../../../archive/foo/bar/2005/</p>
<p>Testing...
This needs to work.
@import '../../../../../syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
Expand All @@ -56,9 +56,9 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd>../../../../</dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dt>@ENTRY_CAPTION@:</dt>
Expand Down
14 changes: 7 additions & 7 deletions test/out/archive/foo/bar/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en">
<head>
<title>This is a Mono.Posix title - Jonathan Pryor's web log</title>
<title>This is a Mono.Posix title - Test web log</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" title="default">
@import '../../../../styles.css';
Expand All @@ -13,10 +13,10 @@ <h1>Lame Blog Test Template</h1>
<h2>Simple Substitutions:</h2>
<dl>
<dt>@BASEDIR@:</dt><dd>../../../</dd>
<dt>@DESCRIPTION@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@EDITOR@:</dt><dd>jonpryor@vt.edu</dd>
<dt>@DESCRIPTION@:</dt><dd>Test web log</dd>
<dt>@EDITOR@:</dt><dd>test@example.com</dd>
<dt>@RSSFILENAME@:</dt><dd>test</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Jonathan Pryor's web log</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Test web log</dd>
</dl>
<h2>Complex Substitutions:</h2>
<h3>@BLOG_ENTRY_INDEX@:</h3>
Expand All @@ -34,7 +34,7 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>@ENTRY_PATH@=../../../archive/foo/bar/2005/</p>
<p>Testing...
This needs to work.
@import '../../../../syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
Expand All @@ -55,9 +55,9 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd>../../../</dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dt>@ENTRY_CAPTION@:</dt>
Expand Down
27 changes: 14 additions & 13 deletions test/out/archive/foo/bar/test.rss2
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by RSS.NET: http://rss-net.sf.net-->
<rss version="2.0">
<channel>
<title>Jonathan Pryor's web log</title>
<description>Jonathan Pryor's web log</description>
<link>http://www.jprl.com/Blog/index.html</link>
<copyright>Jonathan Pryor</copyright>
<managingEditor>jonpryor@vt.edu</managingEditor>
<pubDate>Wed, 20 Jul 2005 14:48:00 GMT</pubDate>
<title>Test web log</title>
<description>Test web log</description>
<link>http://www.example.com/Blog/index.html</link>
<copyright>Test Copyright Owner</copyright>
<managingEditor>test@example.com</managingEditor>
<pubDate>Wed, 20 Jul 2005 14:48:00 -0500</pubDate>
<docs>http://backend.userland.com/rss</docs>
<generator>lb#</generator>
<item>
<title>This is a Mono.Posix title</title>
<description>&lt;p&gt;\@ENTRY_PATH\@=@ENTRY_PATH@&lt;/p&gt;
<description>&lt;p&gt;@ENTRY_PATH@=http://www.example.com/Blog/archive/foo/bar/2005/&lt;/p&gt;
&lt;p&gt;Testing...
This needs to work.
@import '../@BASEDIR@syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
email2@foo.org @ and @ email@bar.org
\escape at beginning:
escape at end\
\@ESCAPE_AT_START\@
\@ESCAPE_AT_START2\@
@ESCAPE_AT_START@
@ESCAPE_AT_START2@
@ESCAPE_AT_NL\
@ESCAPE_IN\MIDDLE@
@ESCAPE_IN\MIDDLE@@ANOTHER_ESCAPE@@HERE_TO@
Expand All @@ -31,10 +32,10 @@ escape at end\
@ESCAPE_\@EMBEDDED\@AT\@@
&lt;/p&gt;
</description>
<link>http://www.jprl.com/Blog/archive/foo/bar/2005/Jul-14.html</link>
<link>http://www.example.com/Blog/archive/foo/bar/2005/Jul-14.html</link>
<author>Jonathan Pryor (jonpryor@vt.edu)</author>
<guid isPermaLink="true">http://www.jprl.com/Blog/archive/foo/bar/2005/Jul-14.html</guid>
<pubDate>Thu, 14 Jul 2005 18:49:00 GMT</pubDate>
<guid isPermaLink="true">http://www.example.com/Blog/archive/foo/bar/2005/Jul-14.html</guid>
<pubDate>Thu, 14 Jul 2005 18:49:00 -0500</pubDate>
</item>
</channel>
</rss>
14 changes: 7 additions & 7 deletions test/out/archive/foo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en">
<head>
<title>This is a Mono.Posix title - Jonathan Pryor's web log</title>
<title>This is a Mono.Posix title - Test web log</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css" title="default">
@import '../../../styles.css';
Expand All @@ -13,10 +13,10 @@ <h1>Lame Blog Test Template</h1>
<h2>Simple Substitutions:</h2>
<dl>
<dt>@BASEDIR@:</dt><dd>../../</dd>
<dt>@DESCRIPTION@:</dt><dd>Jonathan Pryor's web log</dd>
<dt>@EDITOR@:</dt><dd>jonpryor@vt.edu</dd>
<dt>@DESCRIPTION@:</dt><dd>Test web log</dd>
<dt>@EDITOR@:</dt><dd>test@example.com</dd>
<dt>@RSSFILENAME@:</dt><dd>test</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Jonathan Pryor's web log</dd>
<dt>@TITLE@:</dt><dd>This is a Mono.Posix title - Test web log</dd>
</dl>
<h2>Complex Substitutions:</h2>
<h3>@BLOG_ENTRY_INDEX@:</h3>
Expand All @@ -34,7 +34,7 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>@ENTRY_PATH@=../../archive/foo/bar/2005/</p>
<p>Testing...
This needs to work.
@import '../../../syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
Expand All @@ -55,9 +55,9 @@ <h2 id="entry-foo-bar-2005-07-14T02:49:00PM" name="">@ENTRY_CAPTION</h2>
<p>Test Variables:</p>
<dl>
<dt>@BASEDIR@:</dt>
<dd>../../</dd>
<dd>http://www.example.com/Blog/</dd>
<dt>@COPYRIGHT@:</dt>
<dd>Jonathan Pryor</dd>
<dd>Test Copyright Owner</dd>
<dt>@ENTRY_ANCHOR@:</dt>
<dd></dd>
<dt>@ENTRY_CAPTION@:</dt>
Expand Down
27 changes: 14 additions & 13 deletions test/out/archive/foo/test.rss2
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by RSS.NET: http://rss-net.sf.net-->
<rss version="2.0">
<channel>
<title>Jonathan Pryor's web log</title>
<description>Jonathan Pryor's web log</description>
<link>http://www.jprl.com/Blog/index.html</link>
<copyright>Jonathan Pryor</copyright>
<managingEditor>jonpryor@vt.edu</managingEditor>
<pubDate>Wed, 20 Jul 2005 14:48:00 GMT</pubDate>
<title>Test web log</title>
<description>Test web log</description>
<link>http://www.example.com/Blog/index.html</link>
<copyright>Test Copyright Owner</copyright>
<managingEditor>test@example.com</managingEditor>
<pubDate>Wed, 20 Jul 2005 14:48:00 -0500</pubDate>
<docs>http://backend.userland.com/rss</docs>
<generator>lb#</generator>
<item>
<title>This is a Mono.Posix title</title>
<description>&lt;p&gt;\@ENTRY_PATH\@=@ENTRY_PATH@&lt;/p&gt;
<description>&lt;p&gt;@ENTRY_PATH@=http://www.example.com/Blog/archive/foo/bar/2005/&lt;/p&gt;
&lt;p&gt;Testing...
This needs to work.
@import '../@BASEDIR@syles.css'
@import '../http://www.example.com/Blog/syles.css'
@BAD_TAG
email@foo.org email@bar.org
email2@foo.org \@ and \@ email@bar.org
email2@foo.org @ and @ email@bar.org
\escape at beginning:
escape at end\
\@ESCAPE_AT_START\@
\@ESCAPE_AT_START2\@
@ESCAPE_AT_START@
@ESCAPE_AT_START2@
@ESCAPE_AT_NL\
@ESCAPE_IN\MIDDLE@
@ESCAPE_IN\MIDDLE@@ANOTHER_ESCAPE@@HERE_TO@
Expand All @@ -31,10 +32,10 @@ escape at end\
@ESCAPE_\@EMBEDDED\@AT\@@
&lt;/p&gt;
</description>
<link>http://www.jprl.com/Blog/archive/foo/bar/2005/Jul-14.html</link>
<link>http://www.example.com/Blog/archive/foo/bar/2005/Jul-14.html</link>
<author>Jonathan Pryor (jonpryor@vt.edu)</author>
<guid isPermaLink="true">http://www.jprl.com/Blog/archive/foo/bar/2005/Jul-14.html</guid>
<pubDate>Thu, 14 Jul 2005 18:49:00 GMT</pubDate>
<guid isPermaLink="true">http://www.example.com/Blog/archive/foo/bar/2005/Jul-14.html</guid>
<pubDate>Thu, 14 Jul 2005 18:49:00 -0500</pubDate>
</item>
</channel>
</rss>
Loading

0 comments on commit 7f37300

Please sign in to comment.