brew/Library/Homebrew/test/test_json.rb
Jack Nagel 997f9d0075 Update multi_json to 1.5.0
This contains updates to the OkJson library that allow objects to define
to_json for serialization, and this will be used in the upcoming options
and deps work.
2013-01-17 21:39:43 -06:00

17 lines
431 B
Ruby

require 'testing_env'
require 'vendor/multi_json'
class JsonSmokeTest < Test::Unit::TestCase
def test_encode
hash = { "foo" => ["bar", "baz"], "qux" => 1 }
json = %q|{"foo":["bar","baz"],"qux":1}|
assert_equal json, MultiJson.encode(hash)
end
def test_decode
hash = { "foo" => ["bar", "baz"], "qux" => 1 }
json = %q|{"foo":["bar","baz"],"qux":1}|
assert_equal hash, MultiJson.decode(json)
end
end