Permalink
Browse files

Add final semicolon to output

Fixes #26.
  • Loading branch information...
lautis committed Jan 29, 2012
1 parent c714c8f commit 41f83ff5e98a8a4a9330598cd041980ec156147e
Showing with 7 additions and 2 deletions.
  1. +1 −1 lib/uglifier.rb
  2. +6 −1 spec/uglifier_spec.rb
View
@@ -96,7 +96,7 @@ def compile(source)
js << "result = UglifyJS.uglify.split_lines(result, #{@options[:max_line_length].to_i})"
end
- js << "return result;"
+ js << "return result + ';';"
@context.exec js.join("\n")
end
View
@@ -25,6 +25,11 @@
Uglifier.new.compile('function foo($super) {return $super}').should include("$super")
end
+ it "adds trailing semicolon to minified source" do
+ source = "function id(i) {return i;};"
+ Uglifier.new.compile(source)[-1].should eql(";")
+ end
+
describe "Copyright Preservation" do
before :all do
@source = <<-EOS
@@ -63,7 +68,7 @@
end
it "mangles variables only if mangle is set to true" do
- code = "function longFunctionName(){}"
+ code = "function longFunctionName(){};"
Uglifier.new(:mangle => false).compile(code).length.should == code.length
end

0 comments on commit 41f83ff

Please sign in to comment.