Sha256: 5c3bf33037a9a450e4173f390129a351adca43387bcc5202f58bfa9e83c38524

Contents?: true

Size: 816 Bytes

Versions: 12

Compression:

Stored size: 816 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: false

require 'test_helper'

class JSONInRactorTest < Test::Unit::TestCase
  def test_generate
    assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
    begin;
      $VERBOSE = nil
      require "json"
      r = Ractor.new do
        json = JSON.generate({
          'a' => 2,
          'b' => 3.141,
          'c' => 'c',
          'd' => [ 1, "b", 3.14 ],
          'e' => { 'foo' => 'bar' },
          'g' => "\"\0\037",
          'h' => 1000.0,
          'i' => 0.001
        })
        JSON.parse(json)
      end
      expected_json = '{"a":2,"b":3.141,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},' +
                      '"g":"\\"\\u0000\\u001f","h":1000.0,"i":0.001}'
      assert_equal(JSON.parse(expected_json), r.take)
    end;
  end
end if defined?(Ractor)

Version data entries

12 entries across 11 versions & 4 rubygems

Version Path
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/json-2.5.1/tests/ractor_test.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/json-2.5.1/tests/ractor_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/json-2.5.1/tests/ractor_test.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/json-2.5.1/tests/ractor_test.rb
cloudsmith-api-0.57.1 vendor/bundle/ruby/2.6.0/gems/json-2.5.1/tests/ractor_test.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/json-2.5.1/tests/ractor_test.rb
json_pure-2.5.1 tests/ractor_test.rb
json-2.5.1 tests/ractor_test.rb
json-2.5.1-java tests/ractor_test.rb
json-2.5.0-java tests/ractor_test.rb
json_pure-2.5.0 tests/ractor_test.rb
json-2.5.0 tests/ractor_test.rb