Skip to content

Commit 3e29a3a

Browse files
committed
use rake/testtask - thus test are easily runnable with 1.9.2 + disable which java test on windows
1 parent 3e4d763 commit 3e29a3a

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

Rakefile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
desc 'Run all tests'
1+
require "rake/testtask"
22

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

129
namespace :gem do
@@ -22,4 +19,6 @@ namespace :gem do
2219
sh "sudo gem uninstall -x closure-compiler"
2320
end
2421

25-
end
22+
end
23+
24+
task :default => :test

test/test_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
if defined?(Gem) and Gem.available?('redgreen')
2+
require 'redgreen' if RUBY_VERSION < "1.9"
3+
end
4+
require 'test/unit'
5+
16
require 'closure-compiler'
27

38
class Test::Unit::TestCase
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ def test_block_syntax
3333
assert result == COMPILED_ADVANCED
3434
end
3535

36+
unless RUBY_PLATFORM =~ /mswin|mingw/ # which won't work on windows
37+
3638
def test_jar_and_java_specifiation
3739
jar = Dir['vendor/closure-compiler-*.jar'].first
3840
java = `which java`.strip
3941
compiler = Compiler.new(:java => java, :jar_file => jar)
4042
assert compiler.compress(ORIGINAL) == COMPILED_SIMPLE
4143
end
44+
45+
end
4246

4347
def test_exceptions
4448
assert_raises(Closure::Error) do

0 commit comments

Comments
 (0)