[iCal4j-commit] iCal4j/src/test/groovy/net/fortuna/ical4j/model RecurSpec.groovy, 1.1, 1.2
Brought to you by:
fortuna
From: Ben F. <fo...@us...> - 2011-02-27 08:58:34
|
Update of /cvsroot/ical4j/iCal4j/src/test/groovy/net/fortuna/ical4j/model In directory vz-cvs-4.sog:/tmp/cvs-serv9252/src/test/groovy/net/fortuna/ical4j/model Modified Files: RecurSpec.groovy Log Message: Use locale-specific first day of week when calculating applicable week days Index: RecurSpec.groovy =================================================================== RCS file: /cvsroot/ical4j/iCal4j/src/test/groovy/net/fortuna/ical4j/model/RecurSpec.groovy,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RecurSpec.groovy 24 Feb 2011 11:03:19 -0000 1.1 --- RecurSpec.groovy 27 Feb 2011 08:58:32 -0000 1.2 *************** *** 38,47 **** def 'verify recurrence rules for date-time'() { expect: ! recur.getDates(start, end, Value.DATE_TIME) == expectedDates where: ! recur | start | end | expectedDates ! new Recur('FREQ=WEEKLY;BYDAY=MO') | new Date('20110101') | new Date('20110201') | [new DateTime('20110103T110000'), new DateTime('20110110T110000'), new DateTime('20110117T110000'), new DateTime('20110124T110000'), new DateTime('20110131T110000')] } } --- 38,142 ---- def 'verify recurrence rules for date-time'() { + setup: 'parse recurrence rule' + def recur = new Recur(rule) + def startDate = new Date(start) + def endDate = new Date(end) + def expectedDates = [] + expected.each { + expectedDates << new DateTime(it) + } + expect: ! recur.getDates(startDate, endDate, Value.DATE_TIME) == expectedDates where: ! rule | start | end | expected ! 'FREQ=WEEKLY;BYDAY=MO' | '20110101' | '20110201' | ['20110103T110000', '20110110T110000', '20110117T110000', '20110124T110000', '20110131T110000'] ! } ! ! def 'verify recurrence rules in different locales'() { ! setup: 'override platform default locale' ! def originalLocale = Locale.default ! Locale.default = Locale.FRANCE ! ! and: 'parse recurrence rule' ! def recur = new Recur(rule) ! def startDate = new Date(start) ! def endDate = new Date(end) ! def expectedDates = [] ! expected.each { ! expectedDates << new DateTime(it) ! } ! ! expect: ! recur.getDates(startDate, endDate, Value.DATE_TIME) == expectedDates ! ! cleanup: ! Locale.default = originalLocale ! ! where: ! rule | start | end | expected ! 'FREQ=WEEKLY;BYDAY=MO' | '20110101' | '20110201' | ['20110103T110000', '20110110T110000', '20110117T110000', '20110124T110000', '20110131T110000'] ! } ! ! def 'verify recurrence rules with a specified interval'() { ! setup: 'parse recurrence rule' ! def recur = new Recur(rule) ! def startDate = new Date(start) ! def endDate = new Date(end) ! def expectedDates = [] ! expected.each { ! expectedDates << new DateTime(it) ! } ! ! expect: ! recur.getDates(startDate, endDate, Value.DATE_TIME) == expectedDates ! ! where: ! rule | start | end | expected ! 'FREQ=WEEKLY;INTERVAL=2;BYDAY=SU' | '20110101' | '20110201' | ['20110109T110000', '20110123T110000'] ! } ! ! def 'verify recurrence rules with a specified WKST'() { ! setup: 'parse recurrence rule' ! def recur = new Recur(rule) ! def startDate = new Date(start) ! def endDate = new Date(end) ! def expectedDates = [] ! expected.each { ! expectedDates << new DateTime(it) ! } ! ! expect: ! recur.getDates(startDate, endDate, Value.DATE_TIME) == expectedDates ! ! where: ! rule | start | end | expected ! 'FREQ=WEEKLY;INTERVAL=2;BYDAY=SU;WKST=MO' | '20110101' | '20110201' | ['20110109T110000', '20110123T110000'] ! } ! ! def 'verify recurrence rules in different locales with a specified interval'() { ! setup: 'override platform default locale' ! def originalLocale = Locale.default ! Locale.default = Locale.FRANCE ! ! and: 'parse recurrence rule' ! def recur = new Recur(rule) ! def startDate = new Date(start) ! def endDate = new Date(end) ! def expectedDates = [] ! expected.each { ! expectedDates << new DateTime(it) ! } ! ! expect: ! recur.getDates(startDate, endDate, Value.DATE_TIME) == expectedDates ! ! cleanup: ! Locale.default = originalLocale ! ! where: ! rule | start | end | expected ! 'FREQ=WEEKLY;INTERVAL=2;BYDAY=SU' | '20110101' | '20110201' | ['20110102T110000', '20110116T110000', '20110130T110000'] } } |