diff --git a/calendar_test.go b/calendar_test.go index df36b80..370788b 100644 --- a/calendar_test.go +++ b/calendar_test.go @@ -493,3 +493,33 @@ func TestIssue77(t *testing.T) { t.Fatalf("Error reading file: %s", err) } } + +func TestIssue111(t *testing.T) { + type Test struct { + name string + fn string + } + for _, test := range []Test{ + {name: "Just the basis", fn: "base-structure.ics"}, + {name: "vtimezone1 section", fn: "vtimezone1.ics"}, + {name: "vevent1 section", fn: "vevent1.ics"}, + {name: "vevent2 section", fn: "vevent2.ics"}, + {name: "scheduleversion section", fn: "scheduleversion.ics"}, + {name: "Just the basis", fn: "base-structure.ics"}, + {name: "vevent2 without description section", fn: "vevent2-no-desc.ics"}, + {name: "vevent2 fixed section", fn: "vevent2-fixed.ics"}, + {name: "Full file", fn: "file1.ics"}, + } { + t.Run(test.name, func(t *testing.T) { + calFile, err := TestData.Open("testdata/issue111/" + test.fn) + if err != nil { + t.Errorf("read file: %v", err) + } + _, err = ParseCalendar(calFile) + if err != nil { + t.Errorf("parse calendar: %v", err) + } + }) + } + +} diff --git a/testdata/issue111/base-structure.ics b/testdata/issue111/base-structure.ics new file mode 100644 index 0000000..04ebd6f --- /dev/null +++ b/testdata/issue111/base-structure.ics @@ -0,0 +1,5 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +END:VCALENDAR diff --git a/testdata/issue111/file1.ics b/testdata/issue111/file1.ics new file mode 100644 index 0000000..bdae63a --- /dev/null +++ b/testdata/issue111/file1.ics @@ -0,0 +1,44 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VTIMEZONE +TZID:Europe/Moscow +X-LIC-LOCATION:Europe/Moscow +BEGIN:STANDARD +TZOFFSETFROM:+0300 +TZOFFSETTO:+0300 +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTEND;TZID=Europe/Moscow;VALUE=DATE:20240324 +DTSTAMP;TZID=Europe/Moscow:00010101T000000 +DTSTART;TZID=Europe/Moscow;VALUE=DATE:20240323 +SEQUENCE:0 +SUMMARY:Все занятия в дистанционном формате +TRANSP:TRANSPARENT +UID:c68bc5ec-e46f-55ae-9f0a-9cea4365dc9b +END:VEVENT +BEGIN:VEVENT +CATEGORIES:ЛК +DESCRIPTION:Преподаватель: Корягин Сергей Викторович\n\nГруппы:\nБСБО-01-2 + 1\nБСБО-02-21\nБСБО-04-21\n +DTEND;TZID=Europe/Moscow:20240902T121000 +DTSTAMP:00010101T000000 +DTSTART;TZID=Europe/Moscow:20240902T104000 +LOCATION:455 (С-20) +RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20241230T210000Z +SEQUENCE:0 +SUMMARY:ЛК Создание инструментальных средств разработки программного обесп + ечения +TRANSP:OPAQUE +UID:f9de3adf-37f2-5710-abaf-27bd64443c70 +X-SCHEDULE_VERSION-ID:8 +END:VEVENT +BEGIN:X-SCHEDULE-VERSION +SVID:8 +X-SV-END:2024-12-30T21:00:00.0000000Z +X-SV-START:2024-09-01T21:00:00.0000000Z +X-SV-TYPE:SEMESTER +END:X-SCHEDULE-VERSION +END:VCALENDAR diff --git a/testdata/issue111/scheduleversion.ics b/testdata/issue111/scheduleversion.ics new file mode 100644 index 0000000..8cbe0ce --- /dev/null +++ b/testdata/issue111/scheduleversion.ics @@ -0,0 +1,11 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:X-SCHEDULE-VERSION +SVID:8 +X-SV-END:2024-12-30T21:00:00.0000000Z +X-SV-START:2024-09-01T21:00:00.0000000Z +X-SV-TYPE:SEMESTER +END:X-SCHEDULE-VERSION +END:VCALENDAR diff --git a/testdata/issue111/vevent1.ics b/testdata/issue111/vevent1.ics new file mode 100644 index 0000000..93c3426 --- /dev/null +++ b/testdata/issue111/vevent1.ics @@ -0,0 +1,14 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VEVENT +DTEND;TZID=Europe/Moscow;VALUE=DATE:20240324 +DTSTAMP;TZID=Europe/Moscow:00010101T000000 +DTSTART;TZID=Europe/Moscow;VALUE=DATE:20240323 +SEQUENCE:0 +SUMMARY:Все занятия в дистанционном формате +TRANSP:TRANSPARENT +UID:c68bc5ec-e46f-55ae-9f0a-9cea4365dc9b +END:VEVENT +END:VCALENDAR diff --git a/testdata/issue111/vevent2-fixed.ics b/testdata/issue111/vevent2-fixed.ics new file mode 100644 index 0000000..48efb53 --- /dev/null +++ b/testdata/issue111/vevent2-fixed.ics @@ -0,0 +1,21 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VEVENT +CATEGORIES:ЛК +DESCRIPTION:Преподаватель: Корягин Сергей Викторович\n\nГруппы:\nБСБО-01-2 + 1\nБСБО-02-21\nБСБО-04-21\n +DTEND;TZID=Europe/Moscow:20240902T121000 +DTSTAMP:00010101T000000 +DTSTART;TZID=Europe/Moscow:20240902T104000 +LOCATION:455 (С-20) +RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20241230T210000Z +SEQUENCE:0 +SUMMARY:ЛК Создание инструментальных средств разработки программного обесп + ечения +TRANSP:OPAQUE +UID:f9de3adf-37f2-5710-abaf-27bd64443c70 +X-SCHEDULE-VERSION-ID:8 +END:VEVENT +END:VCALENDAR diff --git a/testdata/issue111/vevent2-no-desc.ics b/testdata/issue111/vevent2-no-desc.ics new file mode 100644 index 0000000..10bebd8 --- /dev/null +++ b/testdata/issue111/vevent2-no-desc.ics @@ -0,0 +1,19 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VEVENT +CATEGORIES:ЛК +DTEND;TZID=Europe/Moscow:20240902T121000 +DTSTAMP:00010101T000000 +DTSTART;TZID=Europe/Moscow:20240902T104000 +LOCATION:455 (С-20) +RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20241230T210000Z +SEQUENCE:0 +SUMMARY:ЛК Создание инструментальных средств разработки программного обесп + ечения +TRANSP:OPAQUE +UID:f9de3adf-37f2-5710-abaf-27bd64443c70 +X-SCHEDULE_VERSION-ID:8 +END:VEVENT +END:VCALENDAR diff --git a/testdata/issue111/vevent2.ics b/testdata/issue111/vevent2.ics new file mode 100644 index 0000000..33a4a1b --- /dev/null +++ b/testdata/issue111/vevent2.ics @@ -0,0 +1,21 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VEVENT +CATEGORIES:ЛК +DESCRIPTION:Преподаватель: Корягин Сергей Викторович\n\nГруппы:\nБСБО-01-2 + 1\nБСБО-02-21\nБСБО-04-21\n +DTEND;TZID=Europe/Moscow:20240902T121000 +DTSTAMP:00010101T000000 +DTSTART;TZID=Europe/Moscow:20240902T104000 +LOCATION:455 (С-20) +RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20241230T210000Z +SEQUENCE:0 +SUMMARY:ЛК Создание инструментальных средств разработки программного обесп + ечения +TRANSP:OPAQUE +UID:f9de3adf-37f2-5710-abaf-27bd64443c70 +X-SCHEDULE_VERSION-ID:8 +END:VEVENT +END:VCALENDAR diff --git a/testdata/issue111/vtimezone1.ics b/testdata/issue111/vtimezone1.ics new file mode 100644 index 0000000..f40c332 --- /dev/null +++ b/testdata/issue111/vtimezone1.ics @@ -0,0 +1,13 @@ +BEGIN:VCALENDAR +PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN +VERSION:2.0 +X-WR-CALNAME:БСБО-01-21 +BEGIN:VTIMEZONE +TZID:Europe/Moscow +X-LIC-LOCATION:Europe/Moscow +BEGIN:STANDARD +TZOFFSETFROM:+0300 +TZOFFSETTO:+0300 +END:STANDARD +END:VTIMEZONE +END:VCALENDAR