Sha256: 564bfb2241390a0526e715a5dbcb9f7e6da673534ad9dfa0300c7dea4c45f8e6
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
#!/usr/bin/env ruby # encoding: UTF-8 # Ubuntu does not accept arguments to ruby when called using env. To get warnings to show up the -w options is # required. That can be set in the RUBYOPT environment variable. # export RUBYOPT=-w $VERBOSE = true $: << File.join(File.dirname(__FILE__), "../lib") $: << File.join(File.dirname(__FILE__), "../ext") require 'test/unit' require 'stringio' require 'date' require 'oj' $ruby = RUBY_DESCRIPTION.split(' ')[0] $ruby = 'ree' if 'ruby' == $ruby && RUBY_DESCRIPTION.include?('Ruby Enterprise Edition') def hash_eql(h1, h2) return false if h1.size != h2.size h1.keys.each do |k| return false unless h1[k] == h2[k] end true end class StrictJuice < ::Test::Unit::TestCase # Stream IO def test_io_string json = %{{ "x":true, "y":58, "z": [1,2,3] } } input = StringIO.new(json) obj = Oj.strict_loadx(input) assert_equal({ 'x' => true, 'y' => 58, 'z' => [1, 2, 3]}, obj) end def xtest_io_file filename = 'open_file_test.json' File.open(filename, 'w') { |f| f.write(%{{ "x":true, "y":58, "z": [1,2,3] } }) } f = File.new(filename) obj = Oj.strict_loadx(f) f.close() assert_equal({ 'x' => true, 'y' => 58, 'z' => [1, 2, 3]}, obj) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
oj-2.9.4 | test/test_strictx.rb |
oj-2.9.3 | test/test_strictx.rb |
oj-2.9.2 | test/test_strictx.rb |
oj-2.9.1 | test/test_strictx.rb |