Test that the tab round-trips through JSON

This commit is contained in:
Jack Nagel 2014-06-29 22:18:44 -05:00
parent cd91709120
commit 07171f5527

View File

@ -9,15 +9,15 @@ class TabTests < Homebrew::TestCase
@unused << Option.new("with-baz") << Option.new("without-qux") @unused << Option.new("with-baz") << Option.new("without-qux")
@tab = Tab.new({ @tab = Tab.new({
:used_options => @used, :used_options => @used.map(&:to_s),
:unused_options => @unused, :unused_options => @unused.map(&:to_s),
:built_as_bottle => false, :built_as_bottle => false,
:poured_from_bottle => true, :poured_from_bottle => true,
:tapped_from => "Homebrew/homebrew", :tapped_from => "Homebrew/homebrew",
:time => nil, :time => nil,
:HEAD => TEST_SHA1, :HEAD => TEST_SHA1,
:compiler => :clang, :compiler => "clang",
:stdlib => :libcxx, :stdlib => "libcxx",
}) })
end end
@ -50,6 +50,7 @@ class TabTests < Homebrew::TestCase
def test_universal? def test_universal?
refute_predicate @tab, :universal? refute_predicate @tab, :universal?
@used << "universal" @used << "universal"
@tab.used_options = @used.map(&:to_s)
assert_predicate @tab, :universal? assert_predicate @tab, :universal?
end end
@ -85,6 +86,10 @@ class TabTests < Homebrew::TestCase
assert_equal :clang, tab.cxxstdlib.compiler assert_equal :clang, tab.cxxstdlib.compiler
assert_equal :libcxx, tab.cxxstdlib.type assert_equal :libcxx, tab.cxxstdlib.type
end end
def test_to_json
assert_equal @tab, Tab.new(Utils::JSON.load(@tab.to_json))
end
end end
class TabLoadingTests < Homebrew::TestCase class TabLoadingTests < Homebrew::TestCase