Class: TestParser
- Defined in:
- lib/puppet/vendor/plist/test/test_parser.rb
Instance Method Summary collapse
- #test_comment_handling_and_empty_plist ⇒ Object
-
#test_date_fields ⇒ Object
date fields are credited to.
-
#test_decode_entities ⇒ Object
bug fix for decoding entities reported by Matthias Peick <[email protected]>.
-
#test_empty_dict_key ⇒ Object
bug fix for empty <key> reported by Matthias Peick <[email protected]> reported and fixed by Frederik Seiffert <[email protected]>.
- #test_Plist_parse_xml ⇒ Object
Instance Method Details
#test_comment_handling_and_empty_plist ⇒ Object
83 84 85 86 87 |
# File 'lib/puppet/vendor/plist/test/test_parser.rb', line 83 def test_comment_handling_and_empty_plist assert_nothing_raised do assert_nil( Plist::parse_xml( File.read('test/assets/commented.plist') ) ) end end |
#test_date_fields ⇒ Object
date fields are credited to
62 63 64 65 66 |
# File 'lib/puppet/vendor/plist/test/test_parser.rb', line 62 def test_date_fields result = Plist::parse_xml("test/assets/Cookies.plist") assert_kind_of( DateTime, result.first['Expires'] ) assert_equal( "2007-10-25T12:36:35Z", result.first['Expires'].to_s ) end |
#test_decode_entities ⇒ Object
bug fix for decoding entities
reported by Matthias Peick <[email protected]>
78 79 80 81 |
# File 'lib/puppet/vendor/plist/test/test_parser.rb', line 78 def test_decode_entities data = Plist::parse_xml('<string>Fish & Chips</string>') assert_equal('Fish & Chips', data) end |
#test_empty_dict_key ⇒ Object
bug fix for empty <key> reported by Matthias Peick <[email protected]> reported and fixed by Frederik Seiffert <[email protected]>
71 72 73 74 |
# File 'lib/puppet/vendor/plist/test/test_parser.rb', line 71 def test_empty_dict_key data = Plist::parse_xml("test/assets/test_empty_key.plist"); assert_equal("2", data['key']['subkey']) end |
#test_Plist_parse_xml ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/puppet/vendor/plist/test/test_parser.rb', line 13 def test_Plist_parse_xml result = Plist::parse_xml("test/assets/AlbumData.xml") # dict assert_kind_of( Hash, result ) assert_equal( ["List of Albums", "Minor Version", "Master Image List", "Major Version", "List of Keywords", "Archive Path", "List of Rolls", "Application Version"], result.keys ) # array assert_kind_of( Array, result["List of Rolls"] ) assert_equal( [ {"PhotoCount"=>1, "KeyList"=>["7"], "Parent"=>999000, "Album Type"=>"Regular", "AlbumName"=>"Roll 1", "AlbumId"=>6}], result["List of Rolls"] ) # string assert_kind_of( String, result["Application Version"] ) assert_equal( "5.0.4 (263)", result["Application Version"] ) # integer assert_kind_of( Integer, result["Major Version"] ) assert_equal( 2, result["Major Version"] ) # true assert_kind_of( TrueClass, result["List of Albums"][0]["Master"] ) assert( result["List of Albums"][0]["Master"] ) # false assert_kind_of( FalseClass, result["List of Albums"][1]["SlideShowUseTitles"] ) assert( ! result["List of Albums"][1]["SlideShowUseTitles"] ) end |