$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'xspf' require 'test/unit' class TestOuputFormats < Test::Unit::TestCase def setup @playlist_document = < XSPlF it up! Mayhem & Chaos Coordinator Just a few songs to enjoy while you XSPlF it up! http://mayhem-chaos.net/xspf/xspf_it_up.html http://mayhem-chaos.net/xspf/xspf_it_up/1.0 http://mayhem-chaos.net/xspf/xspf_it_up.html http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793 I Wanna Get High Cypress Hill 174613 http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793 bdc846e7-6c26-4193-82a6-8d1b5a4d3429 Smoke Two Joints Sublime 175466 http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429 http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58 Hash Pipe Weezer 186533 http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58 END_OF_PLAYLIST @expected_smil_output = < END_OF_SMIL # This @expected_html_ouput is not 100% correct because we do not parse the element, therefore XSPF for Ruby does not generate the same HTML xsltproc does. @expected_html_ouput = < XSPlF it up!

XSPlF it up!

creator
Mayhem & Chaos Coordinator
annotation
Just a few songs to enjoy while you XSPlF it up!
info
http://mayhem-chaos.net/xspf/xspf_it_up.html
identifier
http://mayhem-chaos.net/xspf/xspf_it_up/1.0
attribution
    trackList
    1. identifier
      http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793
      creator
      Cypress Hill
      duration
      174613
      meta
      http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793
    2. identifier
      bdc846e7-6c26-4193-82a6-8d1b5a4d3429
      creator
      Sublime
      duration
      175466
      meta
      http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429
    3. identifier
      http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58
      creator
      Weezer
      duration
      186533
      meta
      http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58
    END_OF_HTML # This @expected_html_output is the output of xsltproc and is 100% correct. This should be the @expected_html_output in the future, when XSPF for Ruby will parse the element. # @expected_html_ouput = < # # # XSPlF it up! # # # # #

    XSPlF it up!

    #
    #
    creator
    #
    Mayhem & Chaos Coordinator
    #
    annotation
    #
    Just a few songs to enjoy while you XSPlF it up!
    #
    info
    #
    http://mayhem-chaos.net/xspf/xspf_it_up.html
    #
    identifier
    #
    http://mayhem-chaos.net/xspf/xspf_it_up/1.0
    #
    attribution
    #
    1. #
      location
      #
      http://mayhem-chaos.net/xspf/xspf_it_up.html
      #
    #
    trackList
    #
      #
    1. #
      identifier
      #
      http://musicbrainz.org/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793
      #
      creator
      #
      Cypress Hill
      #
      duration
      #
      174613
      #
      meta
      #
      http://musicbrainz.org/mm-2.1/track/bdab6db0-2fd6-4166-a5fa-fbf2ff213793
      #
    2. #
    3. #
      identifier
      #
      bdc846e7-6c26-4193-82a6-8d1b5a4d3429
      #
      creator
      #
      Sublime
      #
      duration
      #
      175466
      #
      meta
      #
      http://musicbrainz.org/mm-2.1/track/bdc846e7-6c26-4193-82a6-8d1b5a4d3429
      #
    4. #
    5. #
      identifier
      #
      http://musicbrainz.org/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58
      #
      creator
      #
      Weezer
      #
      duration
      #
      186533
      #
      meta
      #
      http://musicbrainz.org/mm-2.1/track/7d9776f7-d428-40dc-a425-3c6e3dce4d58
      #
    6. #
    #
    # # # END_OF_HTML @expected_soundblox_ouput = < END_OF_SOUNDBLOX @xspf = XSPF.new(@playlist_document) end def test_m3u assert_nil(@xspf.to_m3u) end def test_smil assert_equal(@expected_smil_output, @xspf.to_smil) end def test_html assert_equal(@expected_html_ouput, @xspf.to_html) end def test_soundblox assert_equal(@expected_soundblox_ouput, @xspf.to_soundblox) end def test_error assert_raise(NoMethodError) { @xspf.to_other_format } end end