aboutsummaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
authorTeddy Wing2015-06-14 00:52:37 -0400
committerTeddy Wing2015-06-14 00:52:37 -0400
commita6fdd1f6f7a23d03796a04d51220478a50194146 (patch)
tree3b2cc4c36c7109f3c50223b0686dbdeb359c6cb4 /test.sh
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.
Diffstat (limited to 'test.sh')
-rwxr-xr-x[-rw-r--r--]test.sh14
1 files changed, 13 insertions, 1 deletions
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