tests/ical-test.ss
(require "../ical.ss")

; Tests
(define (test-file)
  (ical->x-exprs/file "/Users/jay/Library/Calendars/School.ics"))

(define (test-basic)
  (ical->x-exprs/string
   "BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:Birthdays
PRODID:-//Apple Computer\\, Inc//iCal 1.5//EN
X-WR-RELCALID:541F559C-A52A-11D9-969F-000D93C49CF6
X-WR-TIMEZONE:US/Eastern
CALSCALE;FOO;TEST=BAR:GREGORIAN
END:VCALENDAR"))

(define (test-linefold)
  (ical->x-exprs/string
   "BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:School
PRODID:-//Apple Computer\\, Inc//iCal 1.5//EN
X-WR-RELCALID:4DF37B33-EA3E-11D8-A594-000D93C49CF6
X-WR-TIMEZONE:US/Eastern
CALSCALE;TEST=BAR:GREGORIAN
X-WR-CALDESC:UMass Lowell Fall 2002 Schedule\\nUMass Lowell Spring 2003 S
 chedule\\nUMass Lowell Fall 2004 Schedule\\nUMass Lowell Spring 2005 Sched
 ule
RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20040515T035959Z;BYDAY=MO,WE,TH,FR;WK
 ST=SU
RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20030628T035959Z;BYDAY=MO,TU,WE,TH,FR
 
END:VCALENDAR"))

(define (x-expr-test)
  (ical->x-exprs/string 
   (x-exprs->ical (test-file))))

(define (replace-file-test file)
  (with-output-to-file
      (string-append file "-new")
    (lambda ()
      (fprintf (current-output-port)
               "~a"
               (x-exprs->ical (ical->x-exprs/file file))))))