diff options
author | Florian Frank <flori@ping.de> | 2015-06-13 12:22:44 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2015-06-13 12:22:44 +0200 |
commit | a4d6f51b75ac00ac4f4960b96fae3dbcff173875 (patch) | |
tree | a5bdf558c009193c0298a3cd253ad76b344d4c96 | |
parent | db4c71a7701b95c30f945ee1536240920dcfdc17 (diff) | |
download | json-a4d6f51b75ac00ac4f4960b96fae3dbcff173875.tar.gz |
Move common setup into test_helper.rb
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Rakefile | 6 | ||||
-rw-r--r-- | json.gemspec | bin | 5008 -> 5060 bytes | |||
-rw-r--r-- | json_pure.gemspec | 6 | ||||
-rw-r--r-- | lib/json/pure/generator.rb | 5 | ||||
-rw-r--r-- | tests/test_helper.rb (renamed from tests/setup_variant.rb) | 9 | ||||
-rwxr-xr-x | tests/test_json.rb | 3 | ||||
-rwxr-xr-x | tests/test_json_addition.rb | 3 | ||||
-rw-r--r-- | tests/test_json_encoding.rb | 3 | ||||
-rwxr-xr-x | tests/test_json_fixtures.rb | 3 | ||||
-rwxr-xr-x | tests/test_json_generate.rb | 3 | ||||
-rw-r--r-- | tests/test_json_generic_object.rb | 4 | ||||
-rw-r--r-- | tests/test_json_string_matching.rb | 3 | ||||
-rwxr-xr-x | tests/test_json_unicode.rb | 3 |
14 files changed, 28 insertions, 24 deletions
@@ -8,3 +8,4 @@ gemspec :name => 'json-java' gem 'utils' gem 'test-unit' +gem 'byebug', :platform => :mri @@ -178,7 +178,7 @@ task :test_pure => [ :clean, :do_test_pure ] UndocumentedTestTask.new do |t| t.name = 'do_test_pure' - t.libs << 'lib' + t.libs << 'lib' << 'tests' t.test_files = FileList['tests/test_*.rb'] t.verbose = true t.options = '-v' @@ -261,7 +261,7 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' UndocumentedTestTask.new do |t| t.name = 'do_test_ext' - t.libs << 'lib' + t.libs << 'lib' << 'tests' t.test_files = FileList['tests/test_*.rb'] t.verbose = true t.options = '-v' @@ -335,7 +335,7 @@ else UndocumentedTestTask.new do |t| t.name = 'do_test_ext' - t.libs << 'ext' << 'lib' + t.libs << 'ext' << 'lib' << 'tests' t.test_files = FileList['tests/test_*.rb'] t.verbose = true t.options = '-v' diff --git a/json.gemspec b/json.gemspec Binary files differindex 0b40989..6add5d9 100644 --- a/json.gemspec +++ b/json.gemspec diff --git a/json_pure.gemspec b/json_pure.gemspec index 3631d3c..180208d 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -8,17 +8,17 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Florian Frank"] - s.date = "2015-06-01" + s.date = "2015-06-13" s.description = "This is a JSON implementation in pure Ruby." s.email = "flori@ping.de" s.extra_rdoc_files = ["README.rdoc"] - s.files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb", ".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "ext/json/extconf.rb", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb"] + s.files = ["./tests/test_helper.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb", ".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "ext/json/extconf.rb", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb"] s.homepage = "http://flori.github.com/json" s.licenses = ["Ruby"] s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"] s.rubygems_version = "2.4.6" s.summary = "JSON Implementation for Ruby" - s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + s.test_files = ["./tests/test_helper.rb", "./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] if s.respond_to? :specification_version then s.specification_version = 4 diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 9056a5d..225081f 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -286,8 +286,9 @@ module JSON alias to_hash to_h - # Generates a valid JSON document from object +obj+ and returns the - # result. If no valid JSON document can be created this method raises a + # Generates a valid JSON document from object +obj+ and + # returns the result. If no valid JSON document can be + # created this method raises a # GeneratorError exception. def generate(obj) result = obj.to_json(self) diff --git a/tests/setup_variant.rb b/tests/test_helper.rb index 2dab184..abc9112 100644 --- a/tests/setup_variant.rb +++ b/tests/test_helper.rb @@ -1,3 +1,6 @@ + +gem 'json', File.read('VERSION').chomp + case ENV['JSON'] when 'pure' $:.unshift 'lib' @@ -9,3 +12,9 @@ else $:.unshift 'ext', 'lib' require 'json' end + +require 'test/unit' +begin + require 'byebug' +rescue LoadError +end diff --git a/tests/test_json.rb b/tests/test_json.rb index 7957773..b666dfa 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' require 'stringio' require 'tempfile' require 'ostruct' diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index a30f06a..1105705 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # -*- coding:utf-8 -*- -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' require 'json/add/core' require 'json/add/complex' require 'json/add/rational' diff --git a/tests/test_json_encoding.rb b/tests/test_json_encoding.rb index fa7d878..3536c56 100644 --- a/tests/test_json_encoding.rb +++ b/tests/test_json_encoding.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' class TestJSONEncoding < Test::Unit::TestCase include JSON diff --git a/tests/test_json_fixtures.rb b/tests/test_json_fixtures.rb index 584dffd..d580522 100755 --- a/tests/test_json_fixtures.rb +++ b/tests/test_json_fixtures.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' class TestJSONFixtures < Test::Unit::TestCase def setup diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb index 8db0b78..2fe4760 100755 --- a/tests/test_json_generate.rb +++ b/tests/test_json_generate.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' class TestJSONGenerate < Test::Unit::TestCase include JSON diff --git a/tests/test_json_generic_object.rb b/tests/test_json_generic_object.rb index c43c776..66fc18d 100644 --- a/tests/test_json_generic_object.rb +++ b/tests/test_json_generic_object.rb @@ -1,8 +1,8 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' + class TestJSONGenericObject < Test::Unit::TestCase include JSON diff --git a/tests/test_json_string_matching.rb b/tests/test_json_string_matching.rb index c233df8..2b89588 100644 --- a/tests/test_json_string_matching.rb +++ b/tests/test_json_string_matching.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' require 'stringio' require 'time' diff --git a/tests/test_json_unicode.rb b/tests/test_json_unicode.rb index 8352d5c..f59c36a 100755 --- a/tests/test_json_unicode.rb +++ b/tests/test_json_unicode.rb @@ -1,8 +1,7 @@ #!/usr/bin/env ruby # encoding: utf-8 -require 'test/unit' -require File.join(File.dirname(__FILE__), 'setup_variant') +require 'test_helper' class TestJSONUnicode < Test::Unit::TestCase include JSON |