require "test_helper" describe Plist do it "parses some hdiutil output okay" do hdiutil_output = <<-EOS.undent system-entities content-hint Apple_partition_map dev-entry /dev/disk3s1 potentially-mountable unmapped-content-hint Apple_partition_map content-hint Apple_partition_scheme dev-entry /dev/disk3 potentially-mountable unmapped-content-hint Apple_partition_scheme content-hint Apple_HFS dev-entry /dev/disk3s2 mount-point /private/tmp/dmg.BhfS2g potentially-mountable unmapped-content-hint Apple_HFS volume-kind hfs EOS parsed = Plist.parse_xml(hdiutil_output) parsed.keys.must_equal ["system-entities"] parsed["system-entities"].length.must_equal 3 parsed["system-entities"].map { |e| e["dev-entry"] }.must_equal %w[ /dev/disk3s1 /dev/disk3 /dev/disk3s2 ] end it "does not choke on empty input" do Plist.parse_xml("").must_equal {} end end