Skip to content

Commit

Permalink
use rake/testtask - thus test are easily runnable with 1.9.2 + disabl…
Browse files Browse the repository at this point in the history
…e `which java` test on windows
  • Loading branch information
kares committed Jul 29, 2011
1 parent 3e4d763 commit 3e29a3a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
desc 'Run all tests'
require "rake/testtask"

task :default => :test
task :test do
$LOAD_PATH.unshift(File.expand_path('lib'))
$LOAD_PATH.unshift(File.expand_path('test'))
require 'redgreen' if Gem.available?('redgreen') and RUBY_VERSION < "1.9"
require 'test/unit'
Dir['test/**/test_*.rb'].each {|test| require test }
Rake::TestTask.new do |t|
t.libs += ["lib", "test"]
t.test_files = FileList["test/**/*_test.rb"]
t.verbose = true
end

namespace :gem do
Expand All @@ -22,4 +19,6 @@ namespace :gem do
sh "sudo gem uninstall -x closure-compiler"
end

end
end

task :default => :test
5 changes: 5 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if defined?(Gem) and Gem.available?('redgreen')
require 'redgreen' if RUBY_VERSION < "1.9"
end
require 'test/unit'

require 'closure-compiler'

class Test::Unit::TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ def test_block_syntax
assert result == COMPILED_ADVANCED
end

unless RUBY_PLATFORM =~ /mswin|mingw/ # which won't work on windows

def test_jar_and_java_specifiation
jar = Dir['vendor/closure-compiler-*.jar'].first
java = `which java`.strip
compiler = Compiler.new(:java => java, :jar_file => jar)
assert compiler.compress(ORIGINAL) == COMPILED_SIMPLE
end

end

def test_exceptions
assert_raises(Closure::Error) do
Expand Down

0 comments on commit 3e29a3a

Please sign in to comment.