aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_json.rb
blob: 5724cf41f0126001f73e20ef225ef897e6c7b16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require "testing_env"
require "utils/json"

class JsonSmokeTest < Homebrew::TestCase
  def test_encode
    hash = { "foo" => ["bar", "baz"] }
    json = '{"foo":["bar","baz"]}'
    assert_equal json, Utils::JSON.dump(hash)
  end

  def test_decode
    hash = { "foo" => ["bar", "baz"], "qux" => 1 }
    json = '{"foo":["bar","baz"],"qux":1}'
    assert_equal hash, Utils::JSON.load(json)
  end
end