Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow to use ->pages and ->assets as documented in the synopsis
- Loading branch information
Konrad Bucheli
committed
Jan 12, 2016
1 parent
b323969
commit 114e6d8
Showing
2 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/perl -Ilib/ -I../lib/ -w | ||
# | ||
# Test that the Templer::Site synopsis code works | ||
# | ||
|
||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More qw! no_plan !; | ||
use File::Temp qw! tempdir !; | ||
use File::Path qw! mkpath !; | ||
|
||
|
||
BEGIN {use_ok('Templer::Site');} | ||
require_ok('Templer::Site'); | ||
|
||
|
||
# | ||
# Make a temporary directory | ||
# | ||
my $tmp = tempdir( CLEANUP => 1 ); | ||
ok( -d $tmp, "We created a temporary directory" ); | ||
|
||
# | ||
# Make the input-subdirectory | ||
# | ||
File::Path::mkpath( $tmp . "/input", { verbose => 0, mode => oct(755) } ); | ||
ok( -d $tmp, "We created an input/ directory" ); | ||
open( my $pagefile, '>', $tmp . "/input/test.skx" ); | ||
print $pagefile "test page"; | ||
close( $pagefile); | ||
|
||
open( my $assetfile, '>', $tmp . "/input/test.css" ); | ||
print $assetfile "test asset"; | ||
close( $assetfile); | ||
|
||
|
||
|
||
# | ||
# Now create the Templer::Site object. | ||
# | ||
my $site = Templer::Site->new( suffix => ".skx", | ||
input => "$tmp/input", | ||
output => "$tmp/output" | ||
); | ||
|
||
# | ||
# Get pages | ||
# | ||
my @pages = $site->pages(); | ||
ok( scalar(@pages) == 1, "one page"); | ||
|
||
# | ||
# Get assets | ||
# | ||
my @assets = $site->assets(); | ||
ok( scalar(@assets) == 1, "one asset"); |