Skip to content

Commit fa2c18a

Browse files
committed
Also test for empty RDATE and EXDATE
1 parent 5c4ef08 commit fa2c18a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/src/main/kotlin/at/bitfire/ical4android/validation/EventValidator.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,17 @@ object EventValidator {
170170
/**
171171
* Removes all recurrence information of exceptions of (potentially recurring) events. This is:
172172
* `RRULE`, `RDATE` and `EXDATE`.
173-
* Note: This repair step needs to be applied after all exceptions have been found
173+
* Note: This repair step needs to be applied after all exceptions have been found.
174174
*
175175
* @param exceptions exceptions of an event
176176
*/
177177
@VisibleForTesting
178178
internal fun removeRecurrenceOfExceptions(exceptions: List<Event>) {
179179
for (exception in exceptions) {
180-
exception.rRules.clear() // Drop all RRULEs for the exception
181-
exception.rDates.clear() // Drop all RDATEs for the exception
182-
exception.exDates.clear() // Drop all EXDATEs for the exception
180+
// Drop all RRULEs, RDATEs, EXDATEs for the exception
181+
exception.rRules.clear()
182+
exception.rDates.clear()
183+
exception.exDates.clear()
183184
}
184185
}
185186

lib/src/test/kotlin/at/bitfire/ical4android/validation/EventValidatorTest.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class EventValidatorTest {
371371
}
372372

373373
@Test
374-
fun testRemoveRrulesOfRruleExceptions() {
374+
fun testRemoveRecurrencesOfRecurringWithExceptions() {
375375
// Test manually created event
376376
val tz = DateUtils.ical4jTimeZone("Europe/Paris")
377377
val manualEvent = Event().apply {
@@ -475,6 +475,8 @@ class EventValidatorTest {
475475
)).first()
476476
assertTrue(eventFromReader.rRules.size == 1)
477477
assertTrue(eventFromReader.exceptions.first().rRules.isEmpty())
478+
assertTrue(eventFromReader.exceptions.first().rDates.isEmpty())
479+
assertTrue(eventFromReader.exceptions.first().exDates.isEmpty())
478480
}
479481

480482
@Test

0 commit comments

Comments
 (0)