aboutsummaryrefslogtreecommitdiff
path: root/pastebin/website-pastebin
diff options
context:
space:
mode:
Diffstat (limited to 'pastebin/website-pastebin')
-rwxr-xr-xpastebin/website-pastebin17
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;