diff --git a/core/complex.rbs b/core/complex.rbs index 09d344cd7e..213a3b1c3d 100644 --- a/core/complex.rbs +++ b/core/complex.rbs @@ -126,18 +126,6 @@ # * #fdiv: Returns Complex.rect(self.real/numeric, # self.imag/numeric). # -# ### Working with JSON -# -# * ::json_create: Returns a new Complex object, deserialized from the given -# serialized hash. -# * #as_json: Returns a serialized hash constructed from `self`. -# * #to_json: Returns a JSON string representing `self`. -# -# These methods are provided by the [JSON gem](https://github.com/ruby/json). To -# make these methods available: -# -# require 'json/add/complex' -# class Complex < Numeric # - # Returns the current create identifier. See also JSON.create_id=. - # - def self.create_id: () -> _ToS - - # - # Sets create identifier, which is used to decide if the *json_create* hook of a - # class should be called; initial value is `json_class`: - # JSON.create_id # => 'json_class' - # - def self.create_id=: (_ToS create_id) -> _ToS - # - # Sets or returns the default options for the JSON.dump method. Initially: - # opts = JSON.dump_default_options - # opts # => {:max_nesting=>false, :allow_nan=>true} - # - %a{deprecated} - def self.dump_default_options: () -> options - - # - # Sets or returns the default options for the JSON.dump method. Initially: - # opts = JSON.dump_default_options - # opts # => {:max_nesting=>false, :allow_nan=>true} - # - %a{deprecated} - def self.dump_default_options=: (options) -> options - - # - # Arguments `obj` and `opts` here are the same as arguments `obj` and `opts` in - # JSON.generate. - # - # By default, generates JSON data without checking for circular references in - # `obj` (option `max_nesting` set to `false`, disabled). - # - # Raises an exception if `obj` contains circular references: - # a = []; b = []; a.push(b); b.push(a) - # # Raises SystemStackError (stack level too deep): - # JSON.fast_generate(a) - # - %a{deprecated} - def self?.fast_generate: (_ToJson obj, ?options opts) -> String - # - # See #as_json. - # - def self.json_create: (Hash[String, String] object) -> instance - - # - # Methods BigDecimal#as_json and - # BigDecimal.json_create may be used to serialize and deserialize a - # BigDecimal object; see [Marshal](rdoc-ref:Marshal). - # - # Method BigDecimal#as_json serializes `self`, returning a - # 2-element hash representing `self`: - # - # require 'json/add/bigdecimal' - # x = BigDecimal(2).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} - # y = BigDecimal(2.0, 4).as_json # => {"json_class"=>"BigDecimal", "b"=>"36:0.2e1"} - # z = BigDecimal(Complex(2, 0)).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} - # - # Method JSON.create deserializes such a hash, returning a - # BigDecimal object: - # - # BigDecimal.json_create(x) # => 0.2e1 - # BigDecimal.json_create(y) # => 0.2e1 - # BigDecimal.json_create(z) # => 0.2e1 - # - def as_json: (*untyped) -> Hash[String, String] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/bigdecimal' - # puts BigDecimal(2).to_json - # puts BigDecimal(2.0, 4).to_json - # puts BigDecimal(Complex(2, 0)).to_json - # - # Output: - # - # {"json_class":"BigDecimal","b":"27:0.2e1"} - # {"json_class":"BigDecimal","b":"36:0.2e1"} - # {"json_class":"BigDecimal","b":"27:0.2e1"} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Complex - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Numeric] object) -> instance - - # - # Methods Complex#as_json and Complex.json_create may - # be used to serialize and deserialize a Complex object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Complex#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/complex' - # x = Complex(2).as_json # => {"json_class"=>"Complex", "r"=>2, "i"=>0} - # y = Complex(2.0, 4).as_json # => {"json_class"=>"Complex", "r"=>2.0, "i"=>4} - # - # Method JSON.create deserializes such a hash, returning a Complex - # object: - # - # Complex.json_create(x) # => (2+0i) - # Complex.json_create(y) # => (2.0+4i) - # - def as_json: (*untyped) -> Hash[String, String | Numeric] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/complex' - # puts Complex(2).to_json - # puts Complex(2.0, 4).to_json - # - # Output: - # - # {"json_class":"Complex","r":2,"i":0} - # {"json_class":"Complex","r":2.0,"i":4} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Date - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Integer | Float] object) -> instance - - # - # Methods Date#as_json and Date.json_create may be - # used to serialize and deserialize a Date object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Date#as_json serializes `self`, returning a 2-element hash - # representing `self`: - # - # require 'json/add/date' - # x = Date.today.as_json - # # => {"json_class"=>"Date", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} - # - # Method JSON.create deserializes such a hash, returning a Date - # object: - # - # Date.json_create(x) - # # => # - # - def as_json: (*untyped) -> Hash[String, String | Integer | Float] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/date' - # puts Date.today.to_json - # - # Output: - # - # {"json_class":"Date","y":2023,"m":11,"d":21,"sg":2299161.0} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class DateTime - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Integer | Float] object) -> instance - - # - # Methods DateTime#as_json and DateTime.json_create - # may be used to serialize and deserialize a DateTime object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method DateTime#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/datetime' - # x = DateTime.now.as_json - # # => {"json_class"=>"DateTime", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} - # - # Method JSON.create deserializes such a hash, returning a DateTime - # object: - # - # DateTime.json_create(x) # BUG? Raises Date::Error "invalid date" - # - def as_json: (*untyped) -> Hash[String, String | Integer | Float] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/datetime' - # puts DateTime.now.to_json - # - # Output: - # - # {"json_class":"DateTime","y":2023,"m":11,"d":21,"sg":2299161.0} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Exception - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Array[String] | nil] object) -> instance - - # - # Methods Exception#as_json and Exception.json_create - # may be used to serialize and deserialize a Exception object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Exception#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/exception' - # x = Exception.new('Foo').as_json # => {"json_class"=>"Exception", "m"=>"Foo", "b"=>nil} - # - # Method JSON.create deserializes such a hash, returning a - # Exception object: - # - # Exception.json_create(x) # => # - # - def as_json: (*untyped) -> Hash[String, String | Array[String] | nil] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/exception' - # puts Exception.new('Foo').to_json - # - # Output: - # - # {"json_class":"Exception","m":"Foo","b":null} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class OpenStruct - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Hash[Symbol, untyped]] object) -> instance - - # - # Methods OpenStruct#as_json and - # OpenStruct.json_create may be used to serialize and deserialize a - # OpenStruct object; see [Marshal](rdoc-ref:Marshal). - # - # Method OpenStruct#as_json serializes `self`, returning a - # 2-element hash representing `self`: - # - # require 'json/add/ostruct' - # x = OpenStruct.new('name' => 'Rowdy', :age => nil).as_json - # # => {"json_class"=>"OpenStruct", "t"=>{:name=>'Rowdy', :age=>nil}} - # - # Method JSON.create deserializes such a hash, returning a - # OpenStruct object: - # - # OpenStruct.json_create(x) - # # => # - # - def as_json: (*untyped) -> Hash[String, String | Hash[Symbol, untyped]] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/ostruct' - # puts OpenStruct.new('name' => 'Rowdy', :age => nil).to_json - # - # Output: - # - # {"json_class":"OpenStruct","t":{'name':'Rowdy',"age":null}} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Range[out E] - # - # See #as_json. - # - def self.json_create: [A] (Hash[String, String | [ A, A, bool ]] object) -> Range[A] - - # - # Methods Range#as_json and Range.json_create may be - # used to serialize and deserialize a Range object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Range#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/range' - # x = (1..4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, false]} - # y = (1...4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, true]} - # z = ('a'..'d').as_json # => {"json_class"=>"Range", "a"=>["a", "d", false]} - # - # Method JSON.create deserializes such a hash, returning a Range - # object: - # - # Range.json_create(x) # => 1..4 - # Range.json_create(y) # => 1...4 - # Range.json_create(z) # => "a".."d" - # - def as_json: (*untyped) -> Hash[String, String | [ E, E, bool ]] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/range' - # puts (1..4).to_json - # puts (1...4).to_json - # puts ('a'..'d').to_json - # - # Output: - # - # {"json_class":"Range","a":[1,4,false]} - # {"json_class":"Range","a":[1,4,true]} - # {"json_class":"Range","a":["a","d",false]} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Rational - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Integer] object) -> instance - - # - # Methods Rational#as_json and Rational.json_create - # may be used to serialize and deserialize a Rational object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Rational#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/rational' - # x = Rational(2, 3).as_json - # # => {"json_class"=>"Rational", "n"=>2, "d"=>3} - # - # Method JSON.create deserializes such a hash, returning a Rational - # object: - # - # Rational.json_create(x) - # # => (2/3) - # - def as_json: (*untyped) -> Hash[String, String | Integer] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/rational' - # puts Rational(2, 3).to_json - # - # Output: - # - # {"json_class":"Rational","n":2,"d":3} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Regexp - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Integer] object) -> instance - - # - # Methods Regexp#as_json and Regexp.json_create may be - # used to serialize and deserialize a Regexp object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Regexp#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/regexp' - # x = /foo/.as_json - # # => {"json_class"=>"Regexp", "o"=>0, "s"=>"foo"} - # - # Method JSON.create deserializes such a hash, returning a Regexp - # object: - # - # Regexp.json_create(x) # => /foo/ - # - def as_json: (*untyped) -> Hash[String, String | Integer] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/regexp' - # puts /foo/.to_json - # - # Output: - # - # {"json_class":"Regexp","o":0,"s":"foo"} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Set[unchecked out A] - # - # See #as_json. - # - def self.json_create: [A] (Hash[String, String | Array[A]] object) -> Set[A] - - # - # Methods Set#as_json and Set.json_create may be used - # to serialize and deserialize a Set object; see [Marshal](rdoc-ref:Marshal). - # - # Method Set#as_json serializes `self`, returning a 2-element hash - # representing `self`: - # - # require 'json/add/set' - # x = Set.new(%w/foo bar baz/).as_json - # # => {"json_class"=>"Set", "a"=>["foo", "bar", "baz"]} - # - # Method JSON.create deserializes such a hash, returning a Set - # object: - # - # Set.json_create(x) # => # - # - def as_json: (*untyped) -> Hash[String, String | Array[A]] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/set' - # puts Set.new(%w/foo bar baz/).to_json - # - # Output: - # - # {"json_class":"Set","a":["foo","bar","baz"]} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Struct[E] - # - # See #as_json. - # - def self.json_create: [E] (Hash[String, String | Array[E]] object) -> Struct[E] - - # - # Methods Struct#as_json and Struct.json_create may be - # used to serialize and deserialize a Struct object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Struct#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/struct' - # Customer = Struct.new('Customer', :name, :address, :zip) - # x = Struct::Customer.new.as_json - # # => {"json_class"=>"Struct::Customer", "v"=>[nil, nil, nil]} - # - # Method JSON.create deserializes such a hash, returning a Struct - # object: - # - # Struct::Customer.json_create(x) - # # => # - # - def as_json: (*untyped) -> Hash[String, String | Array[E]] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/struct' - # Customer = Struct.new('Customer', :name, :address, :zip) - # puts Struct::Customer.new.to_json - # - # Output: - # - # {"json_class":"Struct","t":{'name':'Rowdy',"age":null}} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Symbol - # - # See #as_json. - # - def self.json_create: (Hash[String, String] object) -> instance - - # - # Methods Symbol#as_json and Symbol.json_create may be - # used to serialize and deserialize a Symbol object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Symbol#as_json serializes `self`, returning a 2-element - # hash representing `self`: - # - # require 'json/add/symbol' - # x = :foo.as_json - # # => {"json_class"=>"Symbol", "s"=>"foo"} - # - # Method JSON.create deserializes such a hash, returning a Symbol - # object: - # - # Symbol.json_create(x) # => :foo - # - def as_json: (*untyped) -> Hash[String, String] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/symbol' - # puts :foo.to_json - # - # Output: - # - # # {"json_class":"Symbol","s":"foo"} - # - def to_json: (?JSON::State? state) -> String -end - -%a{annotate:rdoc:skip} -class Time - # - # See #as_json. - # - def self.json_create: (Hash[String, String | Integer] object) -> instance - - # - # Methods Time#as_json and Time.json_create may be - # used to serialize and deserialize a Time object; see - # [Marshal](rdoc-ref:Marshal). - # - # Method Time#as_json serializes `self`, returning a 2-element hash - # representing `self`: - # - # require 'json/add/time' - # x = Time.now.as_json - # # => {"json_class"=>"Time", "s"=>1700931656, "n"=>472846644} - # - # Method JSON.create deserializes such a hash, returning a Time - # object: - # - # Time.json_create(x) - # # => 2023-11-25 11:00:56.472846644 -0600 - # - def as_json: (*untyped) -> Hash[String, String | Integer] - - # - # Returns a JSON string representing `self`: - # - # require 'json/add/time' - # puts Time.now.to_json - # - # Output: - # - # {"json_class":"Time","s":1700931678,"n":980650786} - # - def to_json: (?JSON::State? state) -> String -end diff --git a/test/stdlib/json/JSONBigDecimal_test.rb b/test/stdlib/json/JSONBigDecimal_test.rb index e63c9b4599..2eb721e5fe 100644 --- a/test/stdlib/json/JSONBigDecimal_test.rb +++ b/test/stdlib/json/JSONBigDecimal_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/bigdecimal" - -class JSONBigDecimalSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::BigDecimal)" - - def test_json_create - assert_send_type "(Hash[String, String]) -> BigDecimal", - BigDecimal, :json_create, BigDecimal("0").as_json - end -end class JSONBigDecimalInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONComplex_test.rb b/test/stdlib/json/JSONComplex_test.rb index b9fc36772b..245729f223 100644 --- a/test/stdlib/json/JSONComplex_test.rb +++ b/test/stdlib/json/JSONComplex_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/complex" - -class JSONComplexSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Complex)" - - def test_json_create - assert_send_type "(Hash[String, String | Numeric]) -> Complex", - Complex, :json_create, Complex(0).as_json - end -end class JSONComplexInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONDateTime_test.rb b/test/stdlib/json/JSONDateTime_test.rb index fd3c50d632..8ddd338060 100644 --- a/test/stdlib/json/JSONDateTime_test.rb +++ b/test/stdlib/json/JSONDateTime_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/date_time" - -class JSONDateTimeSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::DateTime)" - - def test_json_create - assert_send_type "(Hash[String, String | Integer | Float]) -> DateTime", - DateTime, :json_create, DateTime.now.as_json - end -end class JSONDateTimeInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONDate_test.rb b/test/stdlib/json/JSONDate_test.rb index a2d317fa19..cd796d011c 100644 --- a/test/stdlib/json/JSONDate_test.rb +++ b/test/stdlib/json/JSONDate_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/date" - -class JSONDateSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Date)" - - def test_json_create - assert_send_type "(Hash[String, String | Integer | Float]) -> Date", - Date, :json_create, Date.today.as_json - end -end class JSONDateInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONException_test.rb b/test/stdlib/json/JSONException_test.rb index 42cf2c408b..932be93f81 100644 --- a/test/stdlib/json/JSONException_test.rb +++ b/test/stdlib/json/JSONException_test.rb @@ -1,25 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/exception" - -class JSONExceptionSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Exception)" - - def test_json_create - assert_send_type "(Hash[String, String | nil]) -> Exception", - Exception, :json_create, Exception.new("foo").as_json - end - - def test_json_create_with_backtrace - "foo".unknown - rescue => exception - assert_send_type "(Hash[String, String | Array[String]]) -> Exception", - Exception, :json_create, exception.as_json - end -end class JSONExceptionInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONOpenStruct_test.rb b/test/stdlib/json/JSONOpenStruct_test.rb index 4aacb54810..27dcc3cc94 100644 --- a/test/stdlib/json/JSONOpenStruct_test.rb +++ b/test/stdlib/json/JSONOpenStruct_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/ostruct" - -class JSONOpenStructSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::OpenStruct)" - - def test_json_create - assert_send_type "(Hash[String, String | Hash[Symbol, untyped]]) -> OpenStruct", - OpenStruct, :json_create, OpenStruct.new("foo" => 1).as_json - end -end class JSONOpenStructInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONRange_test.rb b/test/stdlib/json/JSONRange_test.rb index e5a7ba2a1c..78e00ad398 100644 --- a/test/stdlib/json/JSONRange_test.rb +++ b/test/stdlib/json/JSONRange_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/range" - -class JSONRangeSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Range)" - - def test_json_create - assert_send_type "(Hash[String, String | [Integer, Integer, bool]]) -> Range[Integer]", - Range, :json_create, (0..9).as_json - end -end class JSONRangeInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONRational_test.rb b/test/stdlib/json/JSONRational_test.rb index 61c9fa697d..ebb7c4d878 100644 --- a/test/stdlib/json/JSONRational_test.rb +++ b/test/stdlib/json/JSONRational_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/rational" - -class JSONRationalSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Rational)" - - def test_json_create - assert_send_type "(Hash[String, String | Integer]) -> Rational", - Rational, :json_create, Rational(1, 3).as_json - end -end class JSONRationalInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONRegexp_test.rb b/test/stdlib/json/JSONRegexp_test.rb index b30b794153..88e1d7b523 100644 --- a/test/stdlib/json/JSONRegexp_test.rb +++ b/test/stdlib/json/JSONRegexp_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/regexp" - -class JSONRegexpSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Regexp)" - - def test_json_create - assert_send_type "(Hash[String, String | Integer]) -> Regexp", - Regexp, :json_create, /foo/.as_json - end -end class JSONRegexpInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONSet_test.rb b/test/stdlib/json/JSONSet_test.rb index 339c83950c..d004a636b9 100644 --- a/test/stdlib/json/JSONSet_test.rb +++ b/test/stdlib/json/JSONSet_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/set" - -class JSONSetSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Set)" - - def test_json_create - assert_send_type "(Hash[String, String | Array[Integer]]) -> Set[Integer]", - Set, :json_create, Set[1, 2].as_json - end -end class JSONSetInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONStruct_test.rb b/test/stdlib/json/JSONStruct_test.rb index 422c9a8152..f47380e69c 100644 --- a/test/stdlib/json/JSONStruct_test.rb +++ b/test/stdlib/json/JSONStruct_test.rb @@ -1,20 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/struct" - -class JSONStructSingletonTest < Test::Unit::TestCase - include TestHelper - - Foo = Struct.new(:a) - - library "json" - testing "singleton(::Struct)" - - def test_json_create - assert_send_type "(Hash[String, String | Array[Integer]]) -> Struct[Integer]", - Foo, :json_create, Foo.new(1).as_json - end -end class JSONStructInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONSymbol_test.rb b/test/stdlib/json/JSONSymbol_test.rb index e1dc006c0e..076aa0e51f 100644 --- a/test/stdlib/json/JSONSymbol_test.rb +++ b/test/stdlib/json/JSONSymbol_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/symbol" - -class JSONSymbolSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Symbol)" - - def test_json_create - assert_send_type "(Hash[String, String]) -> Symbol", - Symbol, :json_create, :foo.as_json - end -end class JSONSymbolInstanceTest < Test::Unit::TestCase include TestHelper diff --git a/test/stdlib/json/JSONTime_test.rb b/test/stdlib/json/JSONTime_test.rb index 53fc174b17..f64fd585e3 100644 --- a/test/stdlib/json/JSONTime_test.rb +++ b/test/stdlib/json/JSONTime_test.rb @@ -1,18 +1,5 @@ require_relative "../test_helper" require "json" -require "json/add/time" - -class JSONTimeSingletonTest < Test::Unit::TestCase - include TestHelper - - library "json" - testing "singleton(::Time)" - - def test_json_create - assert_send_type "(Hash[String, String | Integer]) -> Time", - Time, :json_create, Time.now.as_json - end -end class JSONTimeInstanceTest < Test::Unit::TestCase include TestHelper