diff options
author | Andy Staudacher <andy.st@gmail.com> | 2009-08-30 07:42:37 -0700 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2009-08-30 07:42:37 -0700 |
commit | b5813f92c7a73e11d47d1943c217fdf6b7e41de9 (patch) | |
tree | e760024d0bd69b9aa5b630643de2b8716260b31e /modules/gallery/tests | |
parent | 22aa0b3092458d6de77837be45721f2722b8d5e0 (diff) |
Improve no_tabs test to print out a complete list of files + line numbers + line snippet.
Diffstat (limited to 'modules/gallery/tests')
-rw-r--r-- | modules/gallery/tests/File_Structure_Test.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 8a97e00b..9018f4c6 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -177,10 +177,20 @@ class File_Structure_Test extends Unit_Test_Case { new GalleryCodeFilterIterator( new RecursiveIteratorIterator( new RecursiveDirectoryIterator(DOCROOT)))); + $errors = array(); foreach ($dir as $file) { - $this->assert_false( - preg_match('/\t/', file_get_contents($file)), - "{$file->getPathname()} has tabs in it"); + $file_as_string = file_get_contents($file); + if (preg_match('/\t/', $file_as_string)) { + foreach (split("\n", $file_as_string) as $l => $line) { + if (preg_match('/\t/', $line)) { + $errors[] = "$file:$l has tab(s) ($line)"; + } + } + } + $file_as_string = null; + } + if ($errors) { + $this->assert_false(true, "tab(s) found:\n" . join("\n", $errors)); } } |