aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-06-14 00:52:37 -0400
committerTeddy Wing2015-06-14 00:52:37 -0400
commita6fdd1f6f7a23d03796a04d51220478a50194146 (patch)
tree3b2cc4c36c7109f3c50223b0686dbdeb359c6cb4
parentb40bd57c22669263ea2db88da07c5abac17157cf (diff)
downloadirssi-hipchat-stfu-a6fdd1f6f7a23d03796a04d51220478a50194146.tar.bz2
Get tests working to test `prettify_hipchat` sub
* test.sh: Create a temporary file `prettify_hipchat.pl` that contains only the `prettify_hipchat` subroutine. Then run `test.pl`. Finally remove the file we created to contain the subroutine. * Require `prettify_hipchat.pl` from test.pl. This file contains only the `prettify_hipchat` subroutine, allowing us to require it without concern.
-rwxr-xr-xtest.pl1
-rwxr-xr-x[-rw-r--r--]test.sh14
2 files changed, 14 insertions, 1 deletions
diff --git a/test.pl b/test.pl
index f227c2d..1b40fd0 100755
--- a/test.pl
+++ b/test.pl
@@ -3,6 +3,7 @@
use strict;
use Test::More tests => 9;
+require 'prettify_hipchat.pl';
my $title_message = <<'END_MESSAGE';
SC-1000 : Some kind of issue text that is kind of long and describes the problem that we saw during testing.
diff --git a/test.sh b/test.sh
index 209ccdb..9449eca 100644..100755
--- a/test.sh
+++ b/test.sh
@@ -1,3 +1,15 @@
#!/usr/bin/env sh
-pcregrep -M '^sub prettify_hipchat {.*(\n|.)*?}' hipchat-stfu.pl
+sub=$(pcregrep -M '^sub prettify_hipchat {.*(\n|.)*?}' hipchat-stfu.pl)
+
+cat > prettify_hipchat.pl <<EOF
+use strict;
+
+$sub
+
+1;
+EOF
+
+./test.pl
+
+rm prettify_hipchat.pl