Permalink
Browse files

use rake/testtask - thus test are easily runnable with 1.9.2 + disabl…

…e `which java` test on windows
  • Loading branch information...
1 parent 3e4d763 commit 3e29a3a858edc19fd68163643f2392e46fdff52d @kares kares committed Jul 29, 2011
Showing with 17 additions and 9 deletions.
  1. +8 −9 Rakefile
  2. +5 −0 test/test_helper.rb
  3. +4 −0 test/unit/{test_closure_compiler.rb → closure_compiler_test.rb}
View
@@ -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
@@ -22,4 +19,6 @@ namespace :gem do
sh "sudo gem uninstall -x closure-compiler"
end
-end
+end
+
+task :default => :test
View
@@ -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
@@ -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

0 comments on commit 3e29a3a

Please sign in to comment.