Skip to content

Commit

Permalink
Test added
Browse files Browse the repository at this point in the history
  • Loading branch information
arran4 committed Nov 15, 2024
1 parent 4b57639 commit 5670d8a
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 0 deletions.
30 changes: 30 additions & 0 deletions calendar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}

}
5 changes: 5 additions & 0 deletions testdata/issue111/base-structure.ics
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions testdata/issue111/file1.ics
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions testdata/issue111/scheduleversion.ics
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions testdata/issue111/vevent1.ics
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions testdata/issue111/vevent2-fixed.ics
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions testdata/issue111/vevent2-no-desc.ics
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions testdata/issue111/vevent2.ics
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions testdata/issue111/vtimezone1.ics
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5670d8a

Please sign in to comment.