]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php
Added minify plugin
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min_unit_tests / test_Minify_CommentPreserver.php
1 <?php
2
3 require_once '_inc.php';
4
5 require_once 'Minify/CommentPreserver.php';
6
7 function test_Minify_CommentPreserver()
8 {
9     global $thisDir;
10     
11     $inOut = array(
12         '/*!*/' => "\n/**/\n"
13         ,'/*!*/a' => "\n/**/\n1A"
14         ,'a/*!*//*!*/b' => "2A\n/**/\n\n/**/\n3B"
15         ,'a/*!*/b/*!*/' => "4A\n/**/\n5B\n/**/\n"
16     );
17
18     foreach ($inOut as $in => $expected) {
19         $actual = Minify_CommentPreserver::process($in, '_test_MCP_processor');
20         $passed = assertTrue($expected === $actual, 'Minify_CommentPreserver');
21         if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
22             echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n";
23             if (!$passed) {
24                 echo "---Expected: " .strlen($expected). " bytes\n\n{$expected}\n\n\n";
25             }
26         }    
27     }
28 }
29
30 function _test_MCP_processor($content, $options = array())
31 {
32     static $callCount = 0;
33     ++$callCount;
34     return $callCount . strtoupper($content);
35 }
36
37 test_Minify_CommentPreserver();