|
| 1 | +BEGIN; |
| 2 | + |
| 3 | +SELECT plan(8); |
| 4 | + |
| 5 | +SET search_path TO _rrule, public; |
| 6 | + |
| 7 | +-- Test 1: RRULESET with space-indented lines (exact scenario from issue #25) |
| 8 | +SELECT is( |
| 9 | + (rruleset(' |
| 10 | + DTSTART:19970902T090000 |
| 11 | + RRULE:FREQ=WEEKLY;UNTIL=19980902T090000 |
| 12 | + '))."dtstart"::TEXT, |
| 13 | + '1997-09-02 09:00:00', |
| 14 | + 'RRULESET with space-indented lines parses DTSTART correctly' |
| 15 | +); |
| 16 | + |
| 17 | +-- Test 2: Verify the RRULE is also parsed correctly from indented input |
| 18 | +SELECT is( |
| 19 | + ((rruleset(' |
| 20 | + DTSTART:19970902T090000 |
| 21 | + RRULE:FREQ=WEEKLY;UNTIL=19980902T090000 |
| 22 | + '))."rrule")[1]."freq"::TEXT, |
| 23 | + 'WEEKLY', |
| 24 | + 'RRULESET with space-indented lines parses RRULE FREQ correctly' |
| 25 | +); |
| 26 | + |
| 27 | +-- Test 3: RRULESET with tab-indented lines |
| 28 | +SELECT is( |
| 29 | + (rruleset(E'\tDTSTART:19970902T090000\n\tRRULE:FREQ=DAILY;COUNT=10\n'))."dtstart"::TEXT, |
| 30 | + '1997-09-02 09:00:00', |
| 31 | + 'RRULESET with tab-indented lines parses DTSTART correctly' |
| 32 | +); |
| 33 | + |
| 34 | +-- Test 4: Verify RRULE from tab-indented input |
| 35 | +SELECT is( |
| 36 | + ((rruleset(E'\tDTSTART:19970902T090000\n\tRRULE:FREQ=DAILY;COUNT=10\n'))."rrule")[1]."freq"::TEXT, |
| 37 | + 'DAILY', |
| 38 | + 'RRULESET with tab-indented lines parses RRULE FREQ correctly' |
| 39 | +); |
| 40 | + |
| 41 | +-- Test 5: RRULESET with mixed whitespace (spaces and tabs) |
| 42 | +SELECT is( |
| 43 | + (rruleset(E' \tDTSTART:19970902T090000\n \t RRULE:FREQ=MONTHLY;COUNT=5\n'))."dtstart"::TEXT, |
| 44 | + '1997-09-02 09:00:00', |
| 45 | + 'RRULESET with mixed spaces and tabs parses DTSTART correctly' |
| 46 | +); |
| 47 | + |
| 48 | +-- Test 6: Verify RRULE from mixed whitespace input |
| 49 | +SELECT is( |
| 50 | + ((rruleset(E' \tDTSTART:19970902T090000\n \t RRULE:FREQ=MONTHLY;COUNT=5\n'))."rrule")[1]."freq"::TEXT, |
| 51 | + 'MONTHLY', |
| 52 | + 'RRULESET with mixed spaces and tabs parses RRULE FREQ correctly' |
| 53 | +); |
| 54 | + |
| 55 | +-- Test 7: Regression test - RRULESET without any indentation still works |
| 56 | +SELECT is( |
| 57 | + (rruleset('DTSTART:19970902T090000 |
| 58 | +RRULE:FREQ=WEEKLY;UNTIL=19980902T090000'))."dtstart"::TEXT, |
| 59 | + '1997-09-02 09:00:00', |
| 60 | + 'RRULESET without indentation still parses DTSTART correctly (regression)' |
| 61 | +); |
| 62 | + |
| 63 | +-- Test 8: Regression test - RRULE without indentation still works |
| 64 | +SELECT is( |
| 65 | + ((rruleset('DTSTART:19970902T090000 |
| 66 | +RRULE:FREQ=WEEKLY;UNTIL=19980902T090000'))."rrule")[1]."freq"::TEXT, |
| 67 | + 'WEEKLY', |
| 68 | + 'RRULESET without indentation still parses RRULE FREQ correctly (regression)' |
| 69 | +); |
| 70 | + |
| 71 | +SELECT * FROM finish(); |
| 72 | + |
| 73 | +ROLLBACK; |
0 commit comments