sr-atom-test 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +66 -0
- data/examples/atom-tools.rb +6 -0
- data/examples/atom.rb +6 -0
- data/tests/atom10_namespace.rb +9 -0
- data/tests/entry_author_email.rb +15 -0
- data/tests/entry_author_map_author.rb +15 -0
- data/tests/entry_author_map_author_2.rb +14 -0
- data/tests/entry_author_name.rb +18 -0
- data/tests/entry_author_uri.rb +19 -0
- data/tests/entry_category_label.rb +14 -0
- data/tests/entry_category_scheme.rb +14 -0
- data/tests/entry_category_term.rb +14 -0
- data/tests/entry_content_application_xml.rb +14 -0
- data/tests/entry_content_base64.rb +16 -0
- data/tests/entry_content_base64_2.rb +16 -0
- data/tests/entry_content_escaped_markup.rb +14 -0
- data/tests/entry_content_inline_markup.rb +14 -0
- data/tests/entry_content_inline_markup_2.rb +14 -0
- data/tests/entry_content_src.rb +14 -0
- data/tests/entry_content_text_plain.rb +14 -0
- data/tests/entry_content_text_plain_brackets.rb +14 -0
- data/tests/entry_content_type.rb +14 -0
- data/tests/entry_content_type_text.rb +14 -0
- data/tests/entry_content_value.rb +14 -0
- data/tests/entry_contributor_email.rb +18 -0
- data/tests/entry_contributor_multiple.rb +32 -0
- data/tests/entry_contributor_name.rb +18 -0
- data/tests/entry_contributor_uri.rb +18 -0
- data/tests/entry_id.rb +14 -0
- data/tests/entry_id_no_normalization_1.rb +14 -0
- data/tests/entry_id_no_normalization_2.rb +14 -0
- data/tests/entry_id_no_normalization_3.rb +14 -0
- data/tests/entry_id_no_normalization_4.rb +14 -0
- data/tests/entry_id_no_normalization_5.rb +14 -0
- data/tests/entry_id_no_normalization_6.rb +14 -0
- data/tests/entry_id_no_normalization_7.rb +14 -0
- data/tests/entry_link_href.rb +14 -0
- data/tests/entry_link_hreflang.rb +14 -0
- data/tests/entry_link_length.rb +14 -0
- data/tests/entry_link_multiple.rb +24 -0
- data/tests/entry_link_no_rel.rb +14 -0
- data/tests/entry_link_rel.rb +14 -0
- data/tests/entry_link_rel_other.rb +14 -0
- data/tests/entry_link_rel_related.rb +14 -0
- data/tests/entry_link_rel_self.rb +14 -0
- data/tests/entry_link_rel_via.rb +14 -0
- data/tests/entry_link_title.rb +14 -0
- data/tests/entry_link_type.rb +14 -0
- data/tests/entry_rights.rb +14 -0
- data/tests/entry_rights_content_value.rb +14 -0
- data/tests/entry_rights_escaped_markup.rb +14 -0
- data/tests/entry_rights_inline_markup.rb +14 -0
- data/tests/entry_rights_inline_markup_2.rb +14 -0
- data/tests/entry_rights_text_plain.rb +14 -0
- data/tests/entry_rights_text_plain_brackets.rb +14 -0
- data/tests/entry_rights_type_default.rb +14 -0
- data/tests/entry_rights_type_text.rb +14 -0
- data/tests/entry_source_author_email.rb +20 -0
- data/tests/entry_source_author_map_author.rb +20 -0
- data/tests/entry_source_author_map_author_2.rb +19 -0
- data/tests/entry_source_author_name.rb +20 -0
- data/tests/entry_source_author_uri.rb +20 -0
- data/tests/entry_source_category_label.rb +16 -0
- data/tests/entry_source_category_scheme.rb +16 -0
- data/tests/entry_source_category_term.rb +16 -0
- data/tests/entry_source_contributor_email.rb +20 -0
- data/tests/entry_source_contributor_multiple.rb +34 -0
- data/tests/entry_source_contributor_name.rb +20 -0
- data/tests/entry_source_contributor_uri.rb +20 -0
- data/tests/entry_source_generator.rb +16 -0
- data/tests/entry_source_generator_uri.rb +16 -0
- data/tests/entry_source_generator_version.rb +16 -0
- data/tests/entry_source_icon.rb +16 -0
- data/tests/entry_source_id.rb +16 -0
- data/tests/entry_source_link_href.rb +16 -0
- data/tests/entry_source_link_hreflang.rb +16 -0
- data/tests/entry_source_link_length.rb +16 -0
- data/tests/entry_source_link_multiple.rb +24 -0
- data/tests/entry_source_link_no_rel.rb +16 -0
- data/tests/entry_source_link_rel.rb +16 -0
- data/tests/entry_source_link_rel_other.rb +16 -0
- data/tests/entry_source_link_rel_related.rb +16 -0
- data/tests/entry_source_link_rel_self.rb +16 -0
- data/tests/entry_source_link_rel_via.rb +16 -0
- data/tests/entry_source_link_title.rb +16 -0
- data/tests/entry_source_link_type.rb +16 -0
- data/tests/entry_source_logo.rb +16 -0
- data/tests/entry_source_rights.rb +16 -0
- data/tests/entry_source_rights_content_type.rb +16 -0
- data/tests/entry_source_rights_content_type_text.rb +16 -0
- data/tests/entry_source_rights_content_value.rb +16 -0
- data/tests/entry_source_rights_escaped_markup.rb +16 -0
- data/tests/entry_source_rights_inline_markup.rb +16 -0
- data/tests/entry_source_rights_inline_markup_2.rb +16 -0
- data/tests/entry_source_rights_text_plain.rb +16 -0
- data/tests/entry_source_subtitle.rb +16 -0
- data/tests/entry_source_subtitle_content_type.rb +16 -0
- data/tests/entry_source_subtitle_content_type_text.rb +16 -0
- data/tests/entry_source_subtitle_content_value.rb +16 -0
- data/tests/entry_source_subtitle_escaped_markup.rb +16 -0
- data/tests/entry_source_subtitle_inline_markup.rb +16 -0
- data/tests/entry_source_subtitle_inline_markup_2.rb +16 -0
- data/tests/entry_source_subtitle_text_plain.rb +16 -0
- data/tests/entry_source_title.rb +16 -0
- data/tests/entry_source_title_content_type.rb +16 -0
- data/tests/entry_source_title_content_type_text.rb +16 -0
- data/tests/entry_source_title_content_value.rb +16 -0
- data/tests/entry_source_title_escaped_markup.rb +16 -0
- data/tests/entry_source_title_inline_markup.rb +16 -0
- data/tests/entry_source_title_inline_markup_2.rb +16 -0
- data/tests/entry_source_title_text_plain.rb +16 -0
- data/tests/entry_summary.rb +14 -0
- data/tests/entry_summary_content_value.rb +14 -0
- data/tests/entry_summary_escaped_markup.rb +14 -0
- data/tests/entry_summary_inline_markup.rb +14 -0
- data/tests/entry_summary_inline_markup_2.rb +14 -0
- data/tests/entry_summary_text_plain.rb +14 -0
- data/tests/entry_summary_type_default.rb +14 -0
- data/tests/entry_summary_type_text.rb +14 -0
- data/tests/entry_title.rb +14 -0
- data/tests/entry_title_content_value.rb +14 -0
- data/tests/entry_title_escaped_markup.rb +14 -0
- data/tests/entry_title_inline_markup.rb +14 -0
- data/tests/entry_title_inline_markup_2.rb +14 -0
- data/tests/entry_title_text_plain.rb +14 -0
- data/tests/entry_title_text_plain_brackets.rb +14 -0
- data/tests/entry_title_type_default.rb +14 -0
- data/tests/entry_title_type_text.rb +14 -0
- data/tests/feed_author_email.rb +16 -0
- data/tests/feed_author_map_author.rb +16 -0
- data/tests/feed_author_map_author_2.rb +15 -0
- data/tests/feed_author_name.rb +16 -0
- data/tests/feed_author_uri.rb +16 -0
- data/tests/feed_contributor_email.rb +16 -0
- data/tests/feed_contributor_multiple.rb +28 -0
- data/tests/feed_contributor_name.rb +16 -0
- data/tests/feed_contributor_uri.rb +16 -0
- data/tests/feed_generator.rb +12 -0
- data/tests/feed_generator_name.rb +12 -0
- data/tests/feed_generator_url.rb +12 -0
- data/tests/feed_generator_version.rb +12 -0
- data/tests/feed_icon.rb +12 -0
- data/tests/feed_id.rb +12 -0
- data/tests/feed_link_href.rb +12 -0
- data/tests/feed_link_hreflang.rb +12 -0
- data/tests/feed_link_length.rb +12 -0
- data/tests/feed_link_multiple.rb +21 -0
- data/tests/feed_link_no_rel.rb +12 -0
- data/tests/feed_link_rel.rb +12 -0
- data/tests/feed_link_rel_other.rb +12 -0
- data/tests/feed_link_rel_related.rb +12 -0
- data/tests/feed_link_rel_self.rb +12 -0
- data/tests/feed_link_rel_via.rb +12 -0
- data/tests/feed_link_title.rb +12 -0
- data/tests/feed_link_type.rb +12 -0
- data/tests/feed_logo.rb +12 -0
- data/tests/feed_rights.rb +12 -0
- data/tests/feed_rights_content_type.rb +12 -0
- data/tests/feed_rights_content_type_text.rb +12 -0
- data/tests/feed_rights_content_value.rb +12 -0
- data/tests/feed_rights_escaped_markup.rb +12 -0
- data/tests/feed_rights_inline_markup.rb +12 -0
- data/tests/feed_rights_inline_markup_2.rb +12 -0
- data/tests/feed_rights_text_plain.rb +12 -0
- data/tests/feed_subtitle.rb +12 -0
- data/tests/feed_subtitle_content_type.rb +12 -0
- data/tests/feed_subtitle_content_type_text.rb +12 -0
- data/tests/feed_subtitle_content_value.rb +12 -0
- data/tests/feed_subtitle_escaped_markup.rb +12 -0
- data/tests/feed_subtitle_inline_markup.rb +12 -0
- data/tests/feed_subtitle_inline_markup_2.rb +12 -0
- data/tests/feed_subtitle_text_plain.rb +12 -0
- data/tests/feed_title.rb +12 -0
- data/tests/feed_title_content_type.rb +12 -0
- data/tests/feed_title_content_type_text.rb +12 -0
- data/tests/feed_title_content_value.rb +12 -0
- data/tests/feed_title_escaped_markup.rb +12 -0
- data/tests/feed_title_inline_markup.rb +12 -0
- data/tests/feed_title_inline_markup_2.rb +12 -0
- data/tests/feed_title_text_plain.rb +12 -0
- data/tests/relative_uri.rb +12 -0
- data/tests/relative_uri_inherit.rb +12 -0
- data/tests/relative_uri_inherit_2.rb +12 -0
- metadata +236 -0
data/README.markdown
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Atom::Test
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
[Atom Syndication Format][atom] test suite for Ruby.
|
|
5
|
+
|
|
6
|
+
Imported from the [Ruby Atom library][atomrb] tests which were
|
|
7
|
+
themselfs imported from the [Universal Feed Parser][ufp].
|
|
8
|
+
|
|
9
|
+
[atom]: http://www.ietf.org/rfc/rfc4287
|
|
10
|
+
[atomrb]: http://atom.rubyforge.org
|
|
11
|
+
[ufp]: http://feedparser.org/tests
|
|
12
|
+
|
|
13
|
+
License
|
|
14
|
+
-------
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2008 Simon Rozet <simon@rozet.name>
|
|
17
|
+
Copyright (c) 2006 Martin Traverso
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
20
|
+
a copy of this software and associated documentation files (the
|
|
21
|
+
"Software"), to deal in the Software without restriction, including
|
|
22
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
23
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
24
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
25
|
+
the following conditions:
|
|
26
|
+
|
|
27
|
+
The above copyright notice and this permission notice shall be
|
|
28
|
+
included in all copies or substantial portions of the Software.
|
|
29
|
+
|
|
30
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
31
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
32
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
34
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
35
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
36
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
37
|
+
|
|
38
|
+
- - -
|
|
39
|
+
|
|
40
|
+
Tests are derived from Universal Feed Parser <http://feedparser.org>
|
|
41
|
+
|
|
42
|
+
Copyright (c) 2002-2005, Mark Pilgrim
|
|
43
|
+
All rights reserved.
|
|
44
|
+
|
|
45
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
46
|
+
are permitted provided that the following conditions are met:
|
|
47
|
+
|
|
48
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
49
|
+
this list of conditions and the following disclaimer.
|
|
50
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
51
|
+
this list of conditions and the following disclaimer in the documentation
|
|
52
|
+
and/or other materials provided with the distribution.
|
|
53
|
+
|
|
54
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
|
|
55
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
56
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
57
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
58
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
59
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
60
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
61
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
62
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
63
|
+
ARISING IN ANY WAY OUT OF THE USE OF
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
data/examples/atom.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
3
|
+
<entry>
|
|
4
|
+
<author>
|
|
5
|
+
<name>Example author</name>
|
|
6
|
+
<email>me@example.com</email>
|
|
7
|
+
<uri>http://example.com/</uri>
|
|
8
|
+
</author>
|
|
9
|
+
</entry>
|
|
10
|
+
</feed>
|
|
11
|
+
XML
|
|
12
|
+
|
|
13
|
+
test = lambda { |feed|
|
|
14
|
+
assert_equal 'me@example.com', feed.entries.first.authors.first.email
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
3
|
+
<entry>
|
|
4
|
+
<author>
|
|
5
|
+
<name>Example author</name>
|
|
6
|
+
<email>me@example.com</email>
|
|
7
|
+
<uri>http://example.com/</uri>
|
|
8
|
+
</author>
|
|
9
|
+
</entry>
|
|
10
|
+
</feed>
|
|
11
|
+
XML
|
|
12
|
+
|
|
13
|
+
test = lambda { |feed|
|
|
14
|
+
assert_equal "Example author (me@example.com)", feed.entries.first.authors.first.to_s
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
3
|
+
<entry>
|
|
4
|
+
<author>
|
|
5
|
+
<name>Example author</name>
|
|
6
|
+
<uri>http://example.com/</uri>
|
|
7
|
+
</author>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example author', feed.entries.first.authors.first.to_s
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry author name
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<author>
|
|
8
|
+
<name>Example author</name>
|
|
9
|
+
<email>me@example.com</email>
|
|
10
|
+
<uri>http://example.com/</uri>
|
|
11
|
+
</author>
|
|
12
|
+
</entry>
|
|
13
|
+
</feed>
|
|
14
|
+
XML
|
|
15
|
+
|
|
16
|
+
test = lambda { |feed|
|
|
17
|
+
assert_equal 'Example author', feed.entries[0].authors.first.name
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry author uri
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<author>
|
|
8
|
+
<name>Example author</name>
|
|
9
|
+
<email>me@example.com</email>
|
|
10
|
+
<uri>http://example.com/</uri>
|
|
11
|
+
</author>
|
|
12
|
+
</entry>
|
|
13
|
+
|
|
14
|
+
</feed>
|
|
15
|
+
XML
|
|
16
|
+
|
|
17
|
+
test = lambda { |feed|
|
|
18
|
+
assert_equal 'http://example.com/', feed.entries[0].authors.first.uri
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry category label
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Atom 1.0 tests', feed.entries[0].categories[0].label
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry category scheme
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'http://feedparser.org/tests/', feed.entries[0].categories[0].scheme
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry category term
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'atom10', feed.entries[0].categories[0].term
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content inline XML
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">Example <b>Atom</b></div></content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content base64-encoded
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="application/octet-stream">
|
|
8
|
+
RXhhbXBsZSA8Yj5BdG9tPC9iPg==
|
|
9
|
+
</content>
|
|
10
|
+
</entry>
|
|
11
|
+
</feed>
|
|
12
|
+
XML
|
|
13
|
+
|
|
14
|
+
test = lambda { |feed|
|
|
15
|
+
assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content base64-encoded
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="application/octet-stream">
|
|
8
|
+
PHA+SGlzdG9yeSBvZiB0aGUgJmx0O2JsaW5rJmd0OyB0YWc8L3A+
|
|
9
|
+
</content>
|
|
10
|
+
</entry>
|
|
11
|
+
</feed>
|
|
12
|
+
XML
|
|
13
|
+
|
|
14
|
+
test = lambda { |feed|
|
|
15
|
+
assert_equal '<p>History of the <blink> tag</p>', feed.entries[0].content.value
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content escaped HTML
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="html">Example <b>Atom</b></content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content inline XHTML
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">Example <b>Atom</b></div></content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content inline XHTML with escaped markup
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">History of the <blink> tag</div></content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'History of the <blink> tag', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content src
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content src="http://example.com/movie.mp4"/>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'http://example.com/movie.mp4', feed.entries[0].content.src
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content with explicit type='text'
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="text">Example Atom</content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example Atom', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content with explicit type='text' contains brackets that are not markup
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="text">History of the <blink> tag</content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'History of the <blink> tag', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content content type defaults to 'text/plain'
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content>Example Atom</content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'text/plain', feed.entries[0].content.mime_type
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content type='text'
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content type="text">Example Atom</content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'text/plain', feed.entries[0].content.mime_type
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry content content value
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<content>Example Atom</content>
|
|
8
|
+
</entry>
|
|
9
|
+
</feed>
|
|
10
|
+
XML
|
|
11
|
+
|
|
12
|
+
test = lambda { |feed|
|
|
13
|
+
assert_equal 'Example Atom', feed.entries[0].content.value
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: entry contributor email
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<contributor>
|
|
8
|
+
<name>Example contributor</name>
|
|
9
|
+
<email>me@example.com</email>
|
|
10
|
+
<uri>http://example.com/</uri>
|
|
11
|
+
</contributor>
|
|
12
|
+
</entry>
|
|
13
|
+
</feed>
|
|
14
|
+
XML
|
|
15
|
+
|
|
16
|
+
test = lambda { |feed|
|
|
17
|
+
assert_equal 'me@example.com', feed.entries[0].contributors[0].email
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
xml = <<XML
|
|
2
|
+
<!--
|
|
3
|
+
Description: multiple entry contributors
|
|
4
|
+
-->
|
|
5
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
6
|
+
<entry>
|
|
7
|
+
<contributor>
|
|
8
|
+
<name>Contributor 1</name>
|
|
9
|
+
<email>me@example.com</email>
|
|
10
|
+
<uri>http://example.com/</uri>
|
|
11
|
+
</contributor>
|
|
12
|
+
<contributor>
|
|
13
|
+
<name>Contributor 2</name>
|
|
14
|
+
<email>you@example.com</email>
|
|
15
|
+
<uri>http://two.example.com/</uri>
|
|
16
|
+
</contributor>
|
|
17
|
+
</entry>
|
|
18
|
+
</feed>
|
|
19
|
+
XML
|
|
20
|
+
|
|
21
|
+
test = lambda { |feed|
|
|
22
|
+
contributors = feed.entries[0].contributors
|
|
23
|
+
|
|
24
|
+
assert_equal 2, contributors.size
|
|
25
|
+
assert_equal 'Contributor 1', contributors[0].name
|
|
26
|
+
assert_equal 'me@example.com', contributors[0].email
|
|
27
|
+
assert_equal 'http://example.com/', contributors[0].uri
|
|
28
|
+
|
|
29
|
+
assert_equal 'Contributor 2', contributors[1].name
|
|
30
|
+
assert_equal 'you@example.com', contributors[1].email
|
|
31
|
+
assert_equal 'http://two.example.com/', contributors[1].uri
|
|
32
|
+
}
|