Skip to content

Commit a4d6f51

Browse files
committed
Move common setup into test_helper.rb
1 parent db4c71a commit a4d6f51

14 files changed

Lines changed: 28 additions & 24 deletions

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ gemspec :name => 'json-java'
88

99
gem 'utils'
1010
gem 'test-unit'
11+
gem 'byebug', :platform => :mri

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ task :test_pure => [ :clean, :do_test_pure ]
178178

179179
UndocumentedTestTask.new do |t|
180180
t.name = 'do_test_pure'
181-
t.libs << 'lib'
181+
t.libs << 'lib' << 'tests'
182182
t.test_files = FileList['tests/test_*.rb']
183183
t.verbose = true
184184
t.options = '-v'
@@ -261,7 +261,7 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
261261

262262
UndocumentedTestTask.new do |t|
263263
t.name = 'do_test_ext'
264-
t.libs << 'lib'
264+
t.libs << 'lib' << 'tests'
265265
t.test_files = FileList['tests/test_*.rb']
266266
t.verbose = true
267267
t.options = '-v'
@@ -335,7 +335,7 @@ else
335335

336336
UndocumentedTestTask.new do |t|
337337
t.name = 'do_test_ext'
338-
t.libs << 'ext' << 'lib'
338+
t.libs << 'ext' << 'lib' << 'tests'
339339
t.test_files = FileList['tests/test_*.rb']
340340
t.verbose = true
341341
t.options = '-v'

json.gemspec

52 Bytes
Binary file not shown.

json_pure.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Gem::Specification.new do |s|
88
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
99
s.require_paths = ["lib"]
1010
s.authors = ["Florian Frank"]
11-
s.date = "2015-06-01"
11+
s.date = "2015-06-13"
1212
s.description = "This is a JSON implementation in pure Ruby."
1313
s.email = "flori@ping.de"
1414
s.extra_rdoc_files = ["README.rdoc"]
15-
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"]
15+
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"]
1616
s.homepage = "http://flori.github.com/json"
1717
s.licenses = ["Ruby"]
1818
s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
1919
s.rubygems_version = "2.4.6"
2020
s.summary = "JSON Implementation for Ruby"
21-
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"]
21+
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"]
2222

2323
if s.respond_to? :specification_version then
2424
s.specification_version = 4

lib/json/pure/generator.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ def to_h
286286

287287
alias to_hash to_h
288288

289-
# Generates a valid JSON document from object +obj+ and returns the
290-
# result. If no valid JSON document can be created this method raises a
289+
# Generates a valid JSON document from object +obj+ and
290+
# returns the result. If no valid JSON document can be
291+
# created this method raises a
291292
# GeneratorError exception.
292293
def generate(obj)
293294
result = obj.to_json(self)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
gem 'json', File.read('VERSION').chomp
3+
14
case ENV['JSON']
25
when 'pure'
36
$:.unshift 'lib'
@@ -9,3 +12,9 @@
912
$:.unshift 'ext', 'lib'
1013
require 'json'
1114
end
15+
16+
require 'test/unit'
17+
begin
18+
require 'byebug'
19+
rescue LoadError
20+
end

tests/test_json.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env ruby
22
# encoding: utf-8
33

4-
require 'test/unit'
5-
require File.join(File.dirname(__FILE__), 'setup_variant')
4+
require 'test_helper'
65
require 'stringio'
76
require 'tempfile'
87
require 'ostruct'

tests/test_json_addition.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env ruby
22
# -*- coding:utf-8 -*-
33

4-
require 'test/unit'
5-
require File.join(File.dirname(__FILE__), 'setup_variant')
4+
require 'test_helper'
65
require 'json/add/core'
76
require 'json/add/complex'
87
require 'json/add/rational'

tests/test_json_encoding.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env ruby
22
# encoding: utf-8
33

4-
require 'test/unit'
5-
require File.join(File.dirname(__FILE__), 'setup_variant')
4+
require 'test_helper'
65

76
class TestJSONEncoding < Test::Unit::TestCase
87
include JSON

tests/test_json_fixtures.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env ruby
22
# encoding: utf-8
33

4-
require 'test/unit'
5-
require File.join(File.dirname(__FILE__), 'setup_variant')
4+
require 'test_helper'
65

76
class TestJSONFixtures < Test::Unit::TestCase
87
def setup

0 commit comments

Comments
 (0)