summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/docblocks17
-rw-r--r--admin/docblocks.pl26
-rw-r--r--admin/runtests6
3 files changed, 48 insertions, 1 deletions
diff --git a/admin/docblocks b/admin/docblocks
new file mode 100644
index 0000000..56cafe6
--- /dev/null
+++ b/admin/docblocks
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#set -e
+
+bad_files=$(find Net Tests -name \*.php |
+ xargs -l1 /usr/bin/env perl admin/docblocks.pl)
+
+if [ "$bad_files" ]
+ then
+ cat <<EOF 1>&2
+These files do not start with docblocks:
+
+$bad_files
+
+EOF
+ exit 1
+fi
+
diff --git a/admin/docblocks.pl b/admin/docblocks.pl
new file mode 100644
index 0000000..0483dbb
--- /dev/null
+++ b/admin/docblocks.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/env perl -w
+
+use strict;
+
+my $filename = $ARGV[0];
+
+if (!$filename) {
+ print "Usage: docblocks.pl <filename>\n";
+ exit(1);
+}
+
+my %allowed = ("" => 1,
+ "<?php" => 1);
+
+open(HANDLE, "<", $filename) or die "Cannot open $filename\n";
+
+while (<HANDLE>) {
+ chomp;
+
+ if ($_ =~ /\/\*\*/) {
+ exit(0);
+ } elsif (!$allowed{$_}) {
+ print $filename."\n";
+ exit(1);
+ }
+}
diff --git a/admin/runtests b/admin/runtests
index d884f1c..72ef639 100644
--- a/admin/runtests
+++ b/admin/runtests
@@ -20,11 +20,15 @@ test_opentag () {
/usr/bin/env bash $(dirname "$0")/open_tag
}
+test_docblocks () {
+ /usr/bin/env bash $(dirname "$0")/docblocks
+}
+
test_php () {
/usr/bin/env php texttest.php
}
-tests="tabs longlines nobadbraces nobadcase opentag php"
+tests="tabs longlines nobadbraces nobadcase opentag docblocks php"
failures=
for test_name in $tests