diff options
Diffstat (limited to 'plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php')
-rw-r--r-- | plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php new file mode 100644 index 000000000..e4e0e9f6b --- /dev/null +++ b/plugins/Minify/extlib/minify/min_unit_tests/test_Minify_CommentPreserver.php @@ -0,0 +1,37 @@ +<?php + +require_once '_inc.php'; + +require_once 'Minify/CommentPreserver.php'; + +function test_Minify_CommentPreserver() +{ + global $thisDir; + + $inOut = array( + '/*!*/' => "\n/**/\n" + ,'/*!*/a' => "\n/**/\n1A" + ,'a/*!*//*!*/b' => "2A\n/**/\n\n/**/\n3B" + ,'a/*!*/b/*!*/' => "4A\n/**/\n5B\n/**/\n" + ); + + foreach ($inOut as $in => $expected) { + $actual = Minify_CommentPreserver::process($in, '_test_MCP_processor'); + $passed = assertTrue($expected === $actual, 'Minify_CommentPreserver'); + if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { + echo "\n---Output: " .strlen($actual). " bytes\n\n{$actual}\n\n"; + if (!$passed) { + echo "---Expected: " .strlen($expected). " bytes\n\n{$expected}\n\n\n"; + } + } + } +} + +function _test_MCP_processor($content, $options = array()) +{ + static $callCount = 0; + ++$callCount; + return $callCount . strtoupper($content); +} + +test_Minify_CommentPreserver();
\ No newline at end of file |