diff --git a/test/unit/processor_test.rb b/test/unit/processor_test.rb index 3222936..f9c47db 100644 --- a/test/unit/processor_test.rb +++ b/test/unit/processor_test.rb @@ -51,8 +51,26 @@ def test_behaviour_processor_minify assert(File.exists?('file.css')) end + # Test that /*! comments are maintained in the output of YUI + def test_preserve_comments_in_css + preserved_comment = '/*! This comment remains */' + removed_comment = '/* This comment is removed */' + + ["file.js", "file.css"].each do |tmp_file| + File.open(tmp_file, 'w') do |tmp_file| + tmp_file.write(preserved_comment) + tmp_file.write(removed_comment) + end + + assert_match /remains/, File.read(@processor.minify_file(tmp_file, nil)), "/*! should be preserved by Yuicompressor" + assert_no_match /removed/, File.read(@processor.minify_file(tmp_file, nil)), "/* should be removed by Yuicompressor" + end + + end + def teardown File.delete('file.css') if File.exists?('file.css') File.delete('file.min.css') if File.exists?('file.min.css') + File.delete('file.js') if File.exists?('file.js') end end \ No newline at end of file