tilia-vobject 4.0.0.pre.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +32 -0
- data/.simplecov +4 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.sabre.md +626 -0
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +68 -0
- data/LICENSE +27 -0
- data/LICENSE.sabre +27 -0
- data/README.md +63 -0
- data/Rakefile +17 -0
- data/bin/vobject +7 -0
- data/lib/tilia/v_object/birthday_calendar_generator.rb +142 -0
- data/lib/tilia/v_object/cli.rb +582 -0
- data/lib/tilia/v_object/component/available.rb +107 -0
- data/lib/tilia/v_object/component/v_alarm.rb +114 -0
- data/lib/tilia/v_object/component/v_availability.rb +128 -0
- data/lib/tilia/v_object/component/v_calendar.rb +468 -0
- data/lib/tilia/v_object/component/v_card.rb +457 -0
- data/lib/tilia/v_object/component/v_event.rb +127 -0
- data/lib/tilia/v_object/component/v_free_busy.rb +81 -0
- data/lib/tilia/v_object/component/v_journal.rb +75 -0
- data/lib/tilia/v_object/component/v_time_zone.rb +51 -0
- data/lib/tilia/v_object/component/v_todo.rb +147 -0
- data/lib/tilia/v_object/component.rb +591 -0
- data/lib/tilia/v_object/date_time_parser.rb +486 -0
- data/lib/tilia/v_object/document.rb +218 -0
- data/lib/tilia/v_object/element_list.rb +18 -0
- data/lib/tilia/v_object/eof_exception.rb +8 -0
- data/lib/tilia/v_object/free_busy_data.rb +149 -0
- data/lib/tilia/v_object/free_busy_generator.rb +465 -0
- data/lib/tilia/v_object/i_tip/broker.rb +909 -0
- data/lib/tilia/v_object/i_tip/i_tip_exception.rb +9 -0
- data/lib/tilia/v_object/i_tip/message.rb +109 -0
- data/lib/tilia/v_object/i_tip/same_organizer_for_all_components_exception.rb +13 -0
- data/lib/tilia/v_object/i_tip.rb +10 -0
- data/lib/tilia/v_object/node.rb +192 -0
- data/lib/tilia/v_object/parameter.rb +327 -0
- data/lib/tilia/v_object/parse_exception.rb +7 -0
- data/lib/tilia/v_object/parser/json.rb +149 -0
- data/lib/tilia/v_object/parser/mime_dir.rb +543 -0
- data/lib/tilia/v_object/parser/parser.rb +61 -0
- data/lib/tilia/v_object/parser/xml/element/key_value.rb +60 -0
- data/lib/tilia/v_object/parser/xml/element.rb +11 -0
- data/lib/tilia/v_object/parser/xml.rb +322 -0
- data/lib/tilia/v_object/parser.rb +10 -0
- data/lib/tilia/v_object/property/binary.rb +96 -0
- data/lib/tilia/v_object/property/boolean.rb +57 -0
- data/lib/tilia/v_object/property/flat_text.rb +52 -0
- data/lib/tilia/v_object/property/float_value.rb +107 -0
- data/lib/tilia/v_object/property/i_calendar/cal_address.rb +49 -0
- data/lib/tilia/v_object/property/i_calendar/date.rb +15 -0
- data/lib/tilia/v_object/property/i_calendar/date_time.rb +330 -0
- data/lib/tilia/v_object/property/i_calendar/duration.rb +65 -0
- data/lib/tilia/v_object/property/i_calendar/period.rb +124 -0
- data/lib/tilia/v_object/property/i_calendar/recur.rb +173 -0
- data/lib/tilia/v_object/property/i_calendar.rb +14 -0
- data/lib/tilia/v_object/property/integer_value.rb +60 -0
- data/lib/tilia/v_object/property/text.rb +352 -0
- data/lib/tilia/v_object/property/time.rb +85 -0
- data/lib/tilia/v_object/property/unknown.rb +30 -0
- data/lib/tilia/v_object/property/uri.rb +78 -0
- data/lib/tilia/v_object/property/utc_offset.rb +56 -0
- data/lib/tilia/v_object/property/v_card/date.rb +31 -0
- data/lib/tilia/v_object/property/v_card/date_and_or_time.rb +343 -0
- data/lib/tilia/v_object/property/v_card/date_time.rb +22 -0
- data/lib/tilia/v_object/property/v_card/language_tag.rb +41 -0
- data/lib/tilia/v_object/property/v_card/time_stamp.rb +74 -0
- data/lib/tilia/v_object/property/v_card.rb +13 -0
- data/lib/tilia/v_object/property.rb +532 -0
- data/lib/tilia/v_object/reader.rb +73 -0
- data/lib/tilia/v_object/recur/event_iterator.rb +417 -0
- data/lib/tilia/v_object/recur/no_instances_exception.rb +11 -0
- data/lib/tilia/v_object/recur/r_date_iterator.rb +138 -0
- data/lib/tilia/v_object/recur/r_rule_iterator.rb +717 -0
- data/lib/tilia/v_object/recur.rb +10 -0
- data/lib/tilia/v_object/settings.rb +32 -0
- data/lib/tilia/v_object/splitter/i_calendar.rb +95 -0
- data/lib/tilia/v_object/splitter/splitter_interface.rb +31 -0
- data/lib/tilia/v_object/splitter/v_card.rb +56 -0
- data/lib/tilia/v_object/splitter.rb +9 -0
- data/lib/tilia/v_object/string_util.rb +58 -0
- data/lib/tilia/v_object/time_zone_data/exchange_zones.rb +96 -0
- data/lib/tilia/v_object/time_zone_data/lotus_zones.rb +104 -0
- data/lib/tilia/v_object/time_zone_data/php_zones.rb +49 -0
- data/lib/tilia/v_object/time_zone_data/windows_zones.rb +121 -0
- data/lib/tilia/v_object/time_zone_data.rb +10 -0
- data/lib/tilia/v_object/time_zone_util.rb +213 -0
- data/lib/tilia/v_object/uuid_util.rb +51 -0
- data/lib/tilia/v_object/v_card_converter.rb +354 -0
- data/lib/tilia/v_object/version.rb +9 -0
- data/lib/tilia/v_object/writer.rb +56 -0
- data/lib/tilia/v_object.rb +45 -0
- data/lib/tilia/vobject.rb +1 -0
- data/resources/schema/xcal.rng +1192 -0
- data/resources/schema/xcard.rng +388 -0
- data/test/test_helper.rb +56 -0
- data/test/v_object/attach_issue_test.rb +19 -0
- data/test/v_object/birthday_calendar_generator_test.rb +463 -0
- data/test/v_object/cli_mock.rb +19 -0
- data/test/v_object/cli_test.rb +460 -0
- data/test/v_object/component/available_test.rb +59 -0
- data/test/v_object/component/v_alarm_test.rb +160 -0
- data/test/v_object/component/v_availability_test.rb +388 -0
- data/test/v_object/component/v_calendar_test.rb +646 -0
- data/test/v_object/component/v_card_test.rb +258 -0
- data/test/v_object/component/v_event_test.rb +85 -0
- data/test/v_object/component/v_free_busy_test.rb +59 -0
- data/test/v_object/component/v_journal_test.rb +85 -0
- data/test/v_object/component/v_time_zone_test.rb +47 -0
- data/test/v_object/component/v_todo_test.rb +172 -0
- data/test/v_object/component_test.rb +419 -0
- data/test/v_object/date_time_parser_test.rb +526 -0
- data/test/v_object/document_test.rb +71 -0
- data/test/v_object/element_list_test.rb +27 -0
- data/test/v_object/em_client_test.rb +53 -0
- data/test/v_object/empty_parameter_test.rb +65 -0
- data/test/v_object/empty_value_issue_test.rb +25 -0
- data/test/v_object/fake_component.rb +21 -0
- data/test/v_object/free_busy_data_test.rb +285 -0
- data/test/v_object/free_busy_generator_test.rb +637 -0
- data/test/v_object/google_colon_escaping_test.rb +27 -0
- data/test/v_object/i_calendar/attach_parse_test.rb +24 -0
- data/test/v_object/i_tip/broker_attendee_reply_test.rb +1042 -0
- data/test/v_object/i_tip/broker_delete_event_test.rb +175 -0
- data/test/v_object/i_tip/broker_new_event_test.rb +440 -0
- data/test/v_object/i_tip/broker_process_message_test.rb +153 -0
- data/test/v_object/i_tip/broker_process_reply_test.rb +402 -0
- data/test/v_object/i_tip/broker_tester.rb +71 -0
- data/test/v_object/i_tip/broker_update_event_test.rb +763 -0
- data/test/v_object/i_tip/evolution_test.rb +2644 -0
- data/test/v_object/i_tip/message_test.rb +25 -0
- data/test/v_object/issue153.vcf +352 -0
- data/test/v_object/issue153_test.rb +12 -0
- data/test/v_object/issue26_test.rb +25 -0
- data/test/v_object/issue36_work_around_test.rb +37 -0
- data/test/v_object/issue40_test.rb +26 -0
- data/test/v_object/issue64.vcf +351 -0
- data/test/v_object/issue64_test.rb +17 -0
- data/test/v_object/issue96_test.rb +22 -0
- data/test/v_object/issue_undefined_index_test.rb +24 -0
- data/test/v_object/j_cal_test.rb +150 -0
- data/test/v_object/j_card_test.rb +192 -0
- data/test/v_object/line_folding_issue_test.rb +19 -0
- data/test/v_object/mock_document.rb +6 -0
- data/test/v_object/parameter_test.rb +109 -0
- data/test/v_object/parser/json_test.rb +370 -0
- data/test/v_object/parser/mime_dir_test.rb +14 -0
- data/test/v_object/parser/quoted_printable_test.rb +78 -0
- data/test/v_object/parser/xml_test.rb +2563 -0
- data/test/v_object/property/binary_test.rb +12 -0
- data/test/v_object/property/boolean_test.rb +18 -0
- data/test/v_object/property/compound_test.rb +43 -0
- data/test/v_object/property/float_test.rb +20 -0
- data/test/v_object/property/i_calendar/cal_address_test.rb +26 -0
- data/test/v_object/property/i_calendar/date_time_test.rb +303 -0
- data/test/v_object/property/i_calendar/duration_test.rb +14 -0
- data/test/v_object/property/i_calendar/recur_test.rb +39 -0
- data/test/v_object/property/text_test.rb +81 -0
- data/test/v_object/property/v_card/date_and_or_time_test.rb +205 -0
- data/test/v_object/property/v_card/language_tag_test.rb +35 -0
- data/test/v_object/property_test.rb +338 -0
- data/test/v_object/reader_test.rb +403 -0
- data/test/v_object/recur/event_iterator/by_month_in_daily_test.rb +52 -0
- data/test/v_object/recur/event_iterator/by_set_pos_hang_test.rb +55 -0
- data/test/v_object/recur/event_iterator/expand_floating_times_test.rb +109 -0
- data/test/v_object/recur/event_iterator/fifth_tuesday_problem_test.rb +45 -0
- data/test/v_object/recur/event_iterator/incorrect_expand_test.rb +53 -0
- data/test/v_object/recur/event_iterator/infinite_loop_problem_test.rb +75 -0
- data/test/v_object/recur/event_iterator/issue48_test.rb +43 -0
- data/test/v_object/recur/event_iterator/issue50_test.rb +123 -0
- data/test/v_object/recur/event_iterator/main_test.rb +1222 -0
- data/test/v_object/recur/event_iterator/missing_overridden_test.rb +55 -0
- data/test/v_object/recur/event_iterator/no_instances_test.rb +32 -0
- data/test/v_object/recur/event_iterator/override_first_event_test.rb +106 -0
- data/test/v_object/recur/r_date_iterator_test.rb +44 -0
- data/test/v_object/recur/r_rule_iterator_test.rb +608 -0
- data/test/v_object/recurrence_iterator/UntilRespectsTimezoneTest.ics +39 -0
- data/test/v_object/slash_r_test.rb +15 -0
- data/test/v_object/splitter/i_calendar_test.rb +299 -0
- data/test/v_object/splitter/v_card_test.rb +173 -0
- data/test/v_object/string_util_test.rb +37 -0
- data/test/v_object/test_case.rb +42 -0
- data/test/v_object/time_zone_util_test.rb +271 -0
- data/test/v_object/uuid_util_test.rb +18 -0
- data/test/v_object/v_card21_test.rb +43 -0
- data/test/v_object/v_card_converter_test.rb +419 -0
- data/test/v_object/version_test.rb +15 -0
- data/test/v_object/writer_test.rb +33 -0
- data/tilia-vobject.gemspec +17 -0
- metadata +308 -0
@@ -0,0 +1,271 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Tilia
|
4
|
+
module VObject
|
5
|
+
class TimeZoneUtilTest < Minitest::Test
|
6
|
+
def setup
|
7
|
+
Tilia::VObject::TimeZoneUtil.map = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
def mapping
|
11
|
+
Tilia::VObject::TimeZoneUtil.load_tz_maps
|
12
|
+
Tilia::VObject::TimeZoneUtil.map.map { |i| [i[1]] }
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_correct_tz
|
16
|
+
mapping.each do |data|
|
17
|
+
(timezone_name,) = data
|
18
|
+
tz = ActiveSupport::TimeZone.new(timezone_name)
|
19
|
+
assert_kind_of(ActiveSupport::TimeZone, tz)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_exchange_map
|
24
|
+
vobj = <<HI
|
25
|
+
BEGIN:VCALENDAR
|
26
|
+
METHOD:REQUEST
|
27
|
+
VERSION:2.0
|
28
|
+
BEGIN:VTIMEZONE
|
29
|
+
TZID:foo
|
30
|
+
X-MICROSOFT-CDO-TZID:2
|
31
|
+
BEGIN:STANDARD
|
32
|
+
DTSTART:16010101T030000
|
33
|
+
TZOFFSETFROM:+0200
|
34
|
+
TZOFFSETTO:+0100
|
35
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
|
36
|
+
END:STANDARD
|
37
|
+
BEGIN:DAYLIGHT
|
38
|
+
DTSTART:16010101T020000
|
39
|
+
TZOFFSETFROM:+0100
|
40
|
+
TZOFFSETTO:+0200
|
41
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
|
42
|
+
END:DAYLIGHT
|
43
|
+
END:VTIMEZONE
|
44
|
+
BEGIN:VEVENT
|
45
|
+
DTSTAMP:20120416T092149Z
|
46
|
+
DTSTART;TZID="foo":20120418T1
|
47
|
+
00000
|
48
|
+
SUMMARY:Begin Unterhaltsreinigung
|
49
|
+
UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
|
50
|
+
0100000008FECD2E607780649BE5A4C9EE6418CBC
|
51
|
+
000
|
52
|
+
END:VEVENT
|
53
|
+
END:VCALENDAR
|
54
|
+
HI
|
55
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('foo', Tilia::VObject::Reader.read(vobj))
|
56
|
+
ex = ActiveSupport::TimeZone.new('Europe/Lisbon')
|
57
|
+
|
58
|
+
assert_equal(ex.name, tz.name)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_wether_microsoft_is_still_insane
|
62
|
+
vobj = <<HI
|
63
|
+
BEGIN:VCALENDAR
|
64
|
+
METHOD:REQUEST
|
65
|
+
VERSION:2.0
|
66
|
+
BEGIN:VTIMEZONE
|
67
|
+
TZID:(GMT+01.00) Sarajevo/Warsaw/Zagreb
|
68
|
+
X-MICROSOFT-CDO-TZID:2
|
69
|
+
BEGIN:STANDARD
|
70
|
+
DTSTART:16010101T030000
|
71
|
+
TZOFFSETFROM:+0200
|
72
|
+
TZOFFSETTO:+0100
|
73
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
|
74
|
+
END:STANDARD
|
75
|
+
END:VTIMEZONE
|
76
|
+
END:VCALENDAR
|
77
|
+
HI
|
78
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('(GMT+01.00) Sarajevo/Warsaw/Zagreb', Tilia::VObject::Reader.read(vobj))
|
79
|
+
ex = ActiveSupport::TimeZone.new('Europe/Sarajevo')
|
80
|
+
|
81
|
+
assert_equal(ex.name, tz.name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_unknown_exchange_id
|
85
|
+
vobj = <<HI
|
86
|
+
BEGIN:VCALENDAR
|
87
|
+
METHOD:REQUEST
|
88
|
+
VERSION:2.0
|
89
|
+
BEGIN:VTIMEZONE
|
90
|
+
TZID:foo
|
91
|
+
X-MICROSOFT-CDO-TZID:2000
|
92
|
+
BEGIN:STANDARD
|
93
|
+
DTSTART:16010101T030000
|
94
|
+
TZOFFSETFROM:+0200
|
95
|
+
TZOFFSETTO:+0100
|
96
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
|
97
|
+
END:STANDARD
|
98
|
+
BEGIN:DAYLIGHT
|
99
|
+
DTSTART:16010101T020000
|
100
|
+
TZOFFSETFROM:+0100
|
101
|
+
TZOFFSETTO:+0200
|
102
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
|
103
|
+
END:DAYLIGHT
|
104
|
+
END:VTIMEZONE
|
105
|
+
BEGIN:VEVENT
|
106
|
+
DTSTAMP:20120416T092149Z
|
107
|
+
DTSTART;TZID="foo":20120418T1
|
108
|
+
00000
|
109
|
+
SUMMARY:Begin Unterhaltsreinigung
|
110
|
+
UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
|
111
|
+
0100000008FECD2E607780649BE5A4C9EE6418CBC
|
112
|
+
DTEND;TZID="Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb":20120418T103
|
113
|
+
000
|
114
|
+
END:VEVENT
|
115
|
+
END:VCALENDAR
|
116
|
+
HI
|
117
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('foo', Tilia::VObject::Reader.read(vobj))
|
118
|
+
ex = Time.zone
|
119
|
+
assert_equal(ex.name, tz.name)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_windows_time_zone
|
123
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('Eastern Standard Time')
|
124
|
+
ex = ActiveSupport::TimeZone.new('America/New_York')
|
125
|
+
assert_equal(ex.name, tz.name)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Ignore testTimeZoneIdentifiers and testTimeZoneBCIdentifiers
|
129
|
+
|
130
|
+
def test_timezone_offset
|
131
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('GMT-0400', nil, true)
|
132
|
+
ex = ActiveSupport::TimeZone.new('Etc/GMT-4')
|
133
|
+
|
134
|
+
assert_equal(ex.name, tz.name)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_timezone_fail
|
138
|
+
assert_raises(ArgumentError) { Tilia::VObject::TimeZoneUtil.time_zone('FooBar', nil, true) }
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_fall_back
|
142
|
+
vobj = <<HI
|
143
|
+
BEGIN:VCALENDAR
|
144
|
+
METHOD:REQUEST
|
145
|
+
VERSION:2.0
|
146
|
+
BEGIN:VTIMEZONE
|
147
|
+
TZID:foo
|
148
|
+
BEGIN:STANDARD
|
149
|
+
DTSTART:16010101T030000
|
150
|
+
TZOFFSETFROM:+0200
|
151
|
+
TZOFFSETTO:+0100
|
152
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
|
153
|
+
END:STANDARD
|
154
|
+
BEGIN:DAYLIGHT
|
155
|
+
DTSTART:16010101T020000
|
156
|
+
TZOFFSETFROM:+0100
|
157
|
+
TZOFFSETTO:+0200
|
158
|
+
RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=-1SU
|
159
|
+
END:DAYLIGHT
|
160
|
+
END:VTIMEZONE
|
161
|
+
BEGIN:VEVENT
|
162
|
+
DTSTAMP:20120416T092149Z
|
163
|
+
DTSTART;TZID="foo":20120418T1
|
164
|
+
00000
|
165
|
+
SUMMARY:Begin Unterhaltsreinigung
|
166
|
+
UID:040000008200E00074C5B7101A82E0080000000010DA091DC31BCD01000000000000000
|
167
|
+
0100000008FECD2E607780649BE5A4C9EE6418CBC
|
168
|
+
000
|
169
|
+
END:VEVENT
|
170
|
+
END:VCALENDAR
|
171
|
+
HI
|
172
|
+
|
173
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('foo', Tilia::VObject::Reader.read(vobj))
|
174
|
+
ex = Time.zone
|
175
|
+
assert_equal(ex.name, tz.name)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_ljubljana_bug
|
179
|
+
vobj = <<HI
|
180
|
+
BEGIN:VCALENDAR
|
181
|
+
CALSCALE:GREGORIAN
|
182
|
+
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
|
183
|
+
VERSION:2.0
|
184
|
+
BEGIN:VTIMEZONE
|
185
|
+
TZID:/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana
|
186
|
+
X-LIC-LOCATION:Europe/Ljubljana
|
187
|
+
BEGIN:STANDARD
|
188
|
+
TZNAME:CET
|
189
|
+
DTSTART:19701028T030000
|
190
|
+
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
191
|
+
TZOFFSETFROM:+0200
|
192
|
+
TZOFFSETTO:+0100
|
193
|
+
END:STANDARD
|
194
|
+
BEGIN:DAYLIGHT
|
195
|
+
TZNAME:CEST
|
196
|
+
DTSTART:19700325T020000
|
197
|
+
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
198
|
+
TZOFFSETFROM:+0100
|
199
|
+
TZOFFSETTO:+0200
|
200
|
+
END:DAYLIGHT
|
201
|
+
END:VTIMEZONE
|
202
|
+
BEGIN:VEVENT
|
203
|
+
UID:foo
|
204
|
+
DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
|
205
|
+
20121003T080000
|
206
|
+
DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana:
|
207
|
+
20121003T083000
|
208
|
+
TRANSP:OPAQUE
|
209
|
+
SEQUENCE:2
|
210
|
+
SUMMARY:testing
|
211
|
+
CREATED:20121002T172613Z
|
212
|
+
LAST-MODIFIED:20121002T172613Z
|
213
|
+
END:VEVENT
|
214
|
+
END:VCALENDAR
|
215
|
+
|
216
|
+
HI
|
217
|
+
|
218
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('/freeassociation.sourceforge.net/Tzfile/Europe/Ljubljana', Tilia::VObject::Reader.read(vobj))
|
219
|
+
ex = ActiveSupport::TimeZone.new('Europe/Ljubljana')
|
220
|
+
assert_equal(ex.name, tz.name)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_weird_system_vli_cs
|
224
|
+
vobj = <<HI
|
225
|
+
BEGIN:VCALENDAR
|
226
|
+
CALSCALE:GREGORIAN
|
227
|
+
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
|
228
|
+
VERSION:2.0
|
229
|
+
BEGIN:VTIMEZONE
|
230
|
+
TZID:/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT
|
231
|
+
X-LIC-LOCATION:SystemV/EST5EDT
|
232
|
+
BEGIN:STANDARD
|
233
|
+
TZNAME:EST
|
234
|
+
DTSTART:19701104T020000
|
235
|
+
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
|
236
|
+
TZOFFSETFROM:-0400
|
237
|
+
TZOFFSETTO:-0500
|
238
|
+
END:STANDARD
|
239
|
+
BEGIN:DAYLIGHT
|
240
|
+
TZNAME:EDT
|
241
|
+
DTSTART:19700311T020000
|
242
|
+
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
|
243
|
+
TZOFFSETFROM:-0500
|
244
|
+
TZOFFSETTO:-0400
|
245
|
+
END:DAYLIGHT
|
246
|
+
END:VTIMEZONE
|
247
|
+
BEGIN:VEVENT
|
248
|
+
UID:20121026T021107Z-6301-1000-1-0@chAir
|
249
|
+
DTSTAMP:20120905T172126Z
|
250
|
+
DTSTART;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
|
251
|
+
20121026T153000
|
252
|
+
DTEND;TZID=/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT:
|
253
|
+
20121026T160000
|
254
|
+
TRANSP:OPAQUE
|
255
|
+
SEQUENCE:5
|
256
|
+
SUMMARY:pick up Ibby
|
257
|
+
CLASS:PUBLIC
|
258
|
+
CREATED:20121026T021108Z
|
259
|
+
LAST-MODIFIED:20121026T021118Z
|
260
|
+
X-EVOLUTION-MOVE-CALENDAR:1
|
261
|
+
END:VEVENT
|
262
|
+
END:VCALENDAR
|
263
|
+
HI
|
264
|
+
|
265
|
+
tz = Tilia::VObject::TimeZoneUtil.time_zone('/freeassociation.sourceforge.net/Tzfile/SystemV/EST5EDT', Tilia::VObject::Reader.read(vobj), true)
|
266
|
+
ex = ActiveSupport::TimeZone.new('EST5EDT') # Ruby supports EST5EDT, sabre/php would say America/New_York
|
267
|
+
assert_equal(ex.name, tz.name)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Tilia
|
4
|
+
module VObject
|
5
|
+
class UUIDUtilTest < Minitest::Test
|
6
|
+
def test_validate_uuid
|
7
|
+
assert(Tilia::VObject::UuidUtil.validate_uuid('11111111-2222-3333-4444-555555555555'))
|
8
|
+
refute(Tilia::VObject::UuidUtil.validate_uuid(' 11111111-2222-3333-4444-555555555555'))
|
9
|
+
assert(Tilia::VObject::UuidUtil.validate_uuid('ffffffff-2222-3333-4444-555555555555'))
|
10
|
+
refute(Tilia::VObject::UuidUtil.validate_uuid('fffffffg-2222-3333-4444-555555555555'))
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_get_uuid
|
14
|
+
assert(Tilia::VObject::UuidUtil.validate_uuid(Tilia::VObject::UuidUtil.uuid))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Tilia
|
4
|
+
module VObject
|
5
|
+
# Assorted vcard 2.1 tests.
|
6
|
+
class VCard21Test < Minitest::Test
|
7
|
+
def test_property_with_no_name
|
8
|
+
input = <<VCF
|
9
|
+
BEGIN:VCARD\r
|
10
|
+
VERSION:2.1\r
|
11
|
+
EMAIL;HOME;WORK:evert@fruux.com\r
|
12
|
+
END:VCARD\r
|
13
|
+
VCF
|
14
|
+
|
15
|
+
vobj = Tilia::VObject::Reader.read(input)
|
16
|
+
output = vobj.serialize
|
17
|
+
|
18
|
+
assert_equal(input, output)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_property_pad_value_count
|
22
|
+
input = <<VCF
|
23
|
+
BEGIN:VCARD
|
24
|
+
VERSION:2.1
|
25
|
+
N:Foo
|
26
|
+
END:VCARD
|
27
|
+
VCF
|
28
|
+
|
29
|
+
vobj = Tilia::VObject::Reader.read(input)
|
30
|
+
output = vobj.serialize
|
31
|
+
|
32
|
+
expected = <<VCF
|
33
|
+
BEGIN:VCARD\r
|
34
|
+
VERSION:2.1\r
|
35
|
+
N:Foo;;;;\r
|
36
|
+
END:VCARD\r
|
37
|
+
VCF
|
38
|
+
|
39
|
+
assert_equal(expected, output)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|