diff options
author | EuAndreh <eu@euandre.org> | 2019-05-21 07:58:12 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-05-21 08:09:47 -0300 |
commit | cc224b7da6db158a72c3479e131a6ad999797313 (patch) | |
tree | 1b70559a58fe442df932bd136071681528f67f06 /pastebin | |
parent | Add Hakyll _cache/ folder to .gitignore (diff) | |
download | euandre.org-cc224b7da6db158a72c3479e131a6ad999797313.tar.gz euandre.org-cc224b7da6db158a72c3479e131a6ad999797313.tar.xz |
Add actual tests to website CLI
Diffstat (limited to '')
-rwxr-xr-x | pastebin/website-pastebin | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pastebin/website-pastebin b/pastebin/website-pastebin index 6061c74..1171dcf 100755 --- a/pastebin/website-pastebin +++ b/pastebin/website-pastebin @@ -42,9 +42,11 @@ use Term::ANSIColor; my $help = 0; my $title = ''; +my $test = 0; GetOptions( 'help|h|?' => \$help, - 'title|t=s' => \$title + 'title|t=s' => \$title, + 'test|?' => \$test ) or pod2usage(-verbose => 1, -exitval => 2); pod2usage( -verbose => 2, @@ -54,7 +56,7 @@ pod2usage( -verbose => 1, -exitval => 2, -message => colored("Missing required --title argument.", "red") -) if !$title; +) if !$title && !$test; # Taken from: # https://stackoverflow.com/a/4009519 @@ -69,6 +71,17 @@ sub slugify { return $input; } +if ($test) { + eval "use Test::More tests => 4"; die $@ if $@; + is(slugify("My Custom Title String"), "my-custom-title-string"); + is(slugify("String with áccents and sym?bol-s."), "string-with-accents-and-symbol-s"); + is(slugify("unicode-↓æđ-chars"), "unicode-aaa-chars"); + is(slugify(" spaces and line +break"), "spaces-and-line-break"); + done_testing(); + exit; +} + our $dirname = dirname(__FILE__); our $in = "$dirname/skeleton.org"; our $out; |