diff options
author | Russ Allbery <rra@cpan.org> | 2021-09-11 19:08:11 -0700 |
---|---|---|
committer | Russ Allbery <rra@cpan.org> | 2021-09-11 19:08:11 -0700 |
commit | b5bd83c074c7456ef7dc269b6ca67645229432da (patch) | |
tree | e8bbc553bdb5a4a18d4ecd0a584108485c1f6e1d /t | |
parent | 8be56ef479fe45d64fd52cc64fbcdfb344e97038 (diff) |
Add test for duplicate sitemap lines
Test the new App::DocKnot::Spin::Sitemap support for detecting
duplicate sitemap entries.
Diffstat (limited to 't')
-rw-r--r-- | t/data/spin/sitemap/duplicate | 4 | ||||
-rwxr-xr-x | t/spin/sitemap.t | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/t/data/spin/sitemap/duplicate b/t/data/spin/sitemap/duplicate new file mode 100644 index 0000000..70aa6af --- /dev/null +++ b/t/data/spin/sitemap/duplicate @@ -0,0 +1,4 @@ +/: Russ Allbery + /faqs/: FAQs and Documentation + /faqs/comments.html: Why This Journal Doesn't Support Comments + /faqs/comments.html: Why This Journal Doesn't Support Comments diff --git a/t/spin/sitemap.t b/t/spin/sitemap.t index 7685864..1cac856 100755 --- a/t/spin/sitemap.t +++ b/t/spin/sitemap.t @@ -15,7 +15,7 @@ use lib 't/lib'; use File::Spec; use Test::RRA qw(is_file_contents); -use Test::More tests => 9; +use Test::More tests => 10; require_ok('App::DocKnot::Spin::Sitemap'); @@ -79,3 +79,13 @@ eval { App::DocKnot::Spin::Sitemap->new($path); }; is($@, "invalid line 3 in $path\n", 'invalid sitemap file'); +# Check error handling. +eval { + $path = File::Spec->catfile($datadir, 'duplicate'); + App::DocKnot::Spin::Sitemap->new($path); +}; +is( + $@, + "duplicate entry for /faqs/comments.html in $path (line 4)\n", + 'sitemap file with duplicates', +); |