aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-06-29 22:18:44 -0500
committerJack Nagel2014-06-29 22:18:44 -0500
commit07171f55275f5aee010a6b529300f2b448863642 (patch)
tree3e6a395d40f46460fc24e8073ab4e70fc67f462a /Library
parentcd91709120d3666a0dc41076798749a07c1365db (diff)
downloadbrew-07171f55275f5aee010a6b529300f2b448863642.tar.bz2
Test that the tab round-trips through JSON
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_tab.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index 7d4406e73..ccea2b1be 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