diff options
-rw-r--r-- | Rakefile | 32 | ||||
-rw-r--r-- | tests/setup_variant.rb | 11 | ||||
-rwxr-xr-x | tests/test_json.rb | 6 | ||||
-rwxr-xr-x | tests/test_json_addition.rb | 6 | ||||
-rw-r--r-- | tests/test_json_encoding.rb | 6 | ||||
-rwxr-xr-x | tests/test_json_fixtures.rb | 6 | ||||
-rwxr-xr-x | tests/test_json_generate.rb | 6 | ||||
-rw-r--r-- | tests/test_json_string_matching.rb | 6 | ||||
-rwxr-xr-x | tests/test_json_unicode.rb | 6 |
9 files changed, 33 insertions, 52 deletions
@@ -101,7 +101,7 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) s.extra_rdoc_files << 'README' s.rdoc_options << '--title' << 'JSON implemention for ruby' << '--main' << 'README' - s.test_files.concat Dir['tests/*.rb'] + s.test_files.concat Dir['./tests/test_*.rb'] s.author = "Florian Frank" s.email = "flori@ping.de" @@ -138,7 +138,7 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension s.extra_rdoc_files << 'README' s.rdoc_options << '--title' << 'JSON implemention for Ruby' << '--main' << 'README' - s.test_files.concat Dir['tests/*.rb'] + s.test_files.concat Dir['./tests/test_*.rb'] s.author = "Florian Frank" s.email = "flori@ping.de" @@ -187,6 +187,17 @@ EOT end end +desc "Testing library (pure ruby)" +task :test_pure => :clean do + ENV['JSON'] = 'pure' + ENV['RUBYOPT'] = "-Ilib #{ENV['RUBYOPT']}" + myruby '-S', 'testrb', *Dir['./tests/test_*.rb'] +end + +desc "Testing library (pure ruby and extension)" +task :test => [ :test_pure, :test_ext ] + + if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do cd JAVA_DIR do @@ -233,7 +244,7 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' desc "Testing library (jruby)" task :test_ext => :create_jar do ENV['JSON'] = 'ext' - myruby '-S', 'testrb', '-Ilib', *Dir['tests/*.rb'] + myruby '-S', 'testrb', '-Ilib', *Dir['./tests/test_*.rb'] end file JRUBY_PARSER_JAR => :compile_ext do @@ -277,9 +288,6 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' desc "Build all gems and archives for a new release of the jruby extension." task :release => [ :clean, :version, :jruby_gem ] - - desc "Testing library (jruby extension)" - task :test => :test_ext else desc "Compiling extension" task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ] @@ -304,7 +312,7 @@ else task :test_ext => :compile_ext do ENV['JSON'] = 'ext' ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}" - myruby '-S', 'testrb', *Dir['./tests/*.rb'] + myruby '-S', 'testrb', *Dir['./tests/test_*.rb'] end desc "Benchmarking parser" @@ -378,16 +386,6 @@ else desc "Generate diagrams of ragel parser" task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ] - desc "Testing library (pure ruby)" - task :test_pure => :clean do - ENV['JSON'] = 'pure' - ENV['RUBYOPT'] = "-Ilib #{ENV['RUBYOPT']}" - myruby '-S', 'testrb', *Dir['tests/*.rb'] - end - - desc "Testing library (pure ruby and extension)" - task :test => [ :test_pure, :test_ext ] - desc "Build all gems and archives for a new release of json and json_pure." task :release => [ :clean, :version, :cross, :native, :gem, ] do sh "#$0 clean native gem" diff --git a/tests/setup_variant.rb b/tests/setup_variant.rb new file mode 100644 index 0000000..2dab184 --- /dev/null +++ b/tests/setup_variant.rb @@ -0,0 +1,11 @@ +case ENV['JSON'] +when 'pure' + $:.unshift 'lib' + require 'json/pure' +when 'ext' + $:.unshift 'ext', 'lib' + require 'json/ext' +else + $:.unshift 'ext', 'lib' + require 'json' +end diff --git a/tests/test_json.rb b/tests/test_json.rb index 00e52f5..2fc3c09 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') require 'stringio' unless Array.method_defined?(:permutation) diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index edf8699..c8bfb41 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -2,11 +2,7 @@ # -*- coding:utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') load 'json/add/core.rb' require 'date' diff --git a/tests/test_json_encoding.rb b/tests/test_json_encoding.rb index cdeca58..7af5e63 100644 --- a/tests/test_json_encoding.rb +++ b/tests/test_json_encoding.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') class TC_JSONEncoding < Test::Unit::TestCase include JSON diff --git a/tests/test_json_fixtures.rb b/tests/test_json_fixtures.rb index 378667f..e9df8f5 100755 --- a/tests/test_json_fixtures.rb +++ b/tests/test_json_fixtures.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') class TC_JSONFixtures < Test::Unit::TestCase def setup diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index 5380a06..e6219df 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') class TC_JSONGenerate < Test::Unit::TestCase include JSON diff --git a/tests/test_json_string_matching.rb b/tests/test_json_string_matching.rb index 0ea12ed..149a63b 100644 --- a/tests/test_json_string_matching.rb +++ b/tests/test_json_string_matching.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') require 'stringio' require 'time' diff --git a/tests/test_json_unicode.rb b/tests/test_json_unicode.rb index 505f5d5..ace56ca 100755 --- a/tests/test_json_unicode.rb +++ b/tests/test_json_unicode.rb @@ -2,11 +2,7 @@ # -*- coding: utf-8 -*- require 'test/unit' -case ENV['JSON'] -when 'pure' then require 'json/pure' -when 'ext' then require 'json/ext' -else require 'json' -end +require File.join(File.dirname(__FILE__), 'setup_variant') class TC_JSONUnicode < Test::Unit::TestCase include JSON |