From 07171f55275f5aee010a6b529300f2b448863642 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 29 Jun 2014 22:18:44 -0500 Subject: [PATCH] Test that the tab round-trips through JSON --- Library/Homebrew/test/test_tab.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index 7d4406e738..ccea2b1be2 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -9,15 +9,15 @@ class TabTests < Homebrew::TestCase @unused << Option.new("with-baz") << Option.new("without-qux") @tab = Tab.new({ - :used_options => @used, - :unused_options => @unused, + :used_options => @used.map(&:to_s), + :unused_options => @unused.map(&:to_s), :built_as_bottle => false, :poured_from_bottle => true, :tapped_from => "Homebrew/homebrew", :time => nil, :HEAD => TEST_SHA1, - :compiler => :clang, - :stdlib => :libcxx, + :compiler => "clang", + :stdlib => "libcxx", }) end @@ -50,6 +50,7 @@ class TabTests < Homebrew::TestCase def test_universal? refute_predicate @tab, :universal? @used << "universal" + @tab.used_options = @used.map(&:to_s) assert_predicate @tab, :universal? end @@ -85,6 +86,10 @@ class TabTests < Homebrew::TestCase assert_equal :clang, tab.cxxstdlib.compiler assert_equal :libcxx, tab.cxxstdlib.type end + + def test_to_json + assert_equal @tab, Tab.new(Utils::JSON.load(@tab.to_json)) + end end class TabLoadingTests < Homebrew::TestCase