Skip to content
Browse files

Add failing test case for large JS file compression.

	* Larger JS files seem to make the child process go to sleep when trying to read from STDERR
	* Reproduces case that breaks Jammit
  • Loading branch information...
1 parent 7f6e272 commit 4e7fa47648a4a143a46dcb44e818875cd0e7e998 @jsl jsl committed Mar 29, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 test/compressor_test.rb
View
12 test/compressor_test.rb
@@ -51,7 +51,14 @@ def test_js_should_be_compressed
@compressor = YUI::JavaScriptCompressor.new
assert_equal "var Foo={a:1};Foo.bar=(function(baz){if(false){doSomething()}else{for(var index=0;index<baz.length;index++){doSomething(baz[index])}}})(\"hello\");", @compressor.compress(FIXTURE_JS)
end
-
+
+ def test_large_js_should_be_compressed
+ assert_nothing_raised do
+ @compressor = YUI::JavaScriptCompressor.new
+ @compressor.compress(FIXTURE_JS * 200)
+ end
+ end
+
def test_compress_should_raise_when_an_unknown_option_is_specified
assert_raises YUI::Compressor::OptionError do
@compressor = YUI::CssCompressor.new(:foo => "bar")
@@ -74,8 +81,7 @@ def test_compress_should_accept_a_block_and_yield_an_io
def test_line_break_option_should_insert_line_breaks_in_css
@compressor = YUI::CssCompressor.new(:line_break => 0)
- assert_equal "div.warning{display:none}\ndiv.error{background:red;color:white}\n@media screen and (max-device-width:640px){body{font-size:90%}\n}", @compressor.compress(FIXTURE_CSS)
-
+ assert_equal "div.warning{display:none}\ndiv.error{background:red;color:white}\n@media screen and (max-device-width:640px){body{font-size:90%}\n}", @compressor.compress(FIXTURE_CSS)
end
def test_line_break_option_should_insert_line_breaks_in_js

0 comments on commit 4e7fa47

Please sign in to comment.
Something went wrong with that request. Please try again.