diff options
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index 9066241..01a55cc 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -109,6 +109,14 @@ assert(days[18] == 'personal', 'first event of the day owns it, got ' assert(days[24] == 'work' and days[26] == 'birthdays', 'later days marked') assert(days[2] == nil, 'October event does not mark September') +-- upcoming: the table's week out of a month-long cache, across a month end. +local up = data.calendar_upcoming({ { y = 2026, m = 10, d = 18 }, + { y = 2026, m = 10, d = 25 }, { y = 2026, m = 10, d = 26 }, + { y = 2026, m = 10, d = 29 } }, { 2026, 10, 18 }, 8) +assert(#up == 2 and up[2].d == 25, 'eight days from the 18th end on the 25th') +assert(#data.calendar_upcoming({ { y = 2026, m = 11, d = 2 } }, + { 2026, 10, 28 }, 8) == 1, 'week crosses into next month') + -- month_shape: September 2026 has 30 days and starts on a Tuesday. -- Monday = 1, so Tuesday = 2. local ndays, first = data.month_shape(2026, 9) |
