2013-01-14 22:32:37 -06:00
|
|
|
require 'testing_env'
|
2013-06-22 16:51:08 -05:00
|
|
|
require 'utils/json'
|
2013-01-14 22:32:37 -06:00
|
|
|
|
|
|
|
class JsonSmokeTest < Test::Unit::TestCase
|
|
|
|
def test_encode
|
2013-01-17 22:25:29 -06:00
|
|
|
hash = { "foo" => ["bar", "baz"] }
|
|
|
|
json = %q|{"foo":["bar","baz"]}|
|
2013-06-22 16:51:08 -05:00
|
|
|
assert_equal json, Utils::JSON.dump(hash)
|
2013-01-14 22:32:37 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_decode
|
|
|
|
hash = { "foo" => ["bar", "baz"], "qux" => 1 }
|
|
|
|
json = %q|{"foo":["bar","baz"],"qux":1}|
|
2013-06-22 16:51:08 -05:00
|
|
|
assert_equal hash, Utils::JSON.load(json)
|
2013-01-14 22:32:37 -06:00
|
|
|
end
|
|
|
|
end
|