diff options
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index 65f92e1..7b84b3d 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -445,4 +445,17 @@ assert(data.breaktimer_parse('running no\n') == nil, 'no generated key: nil') assert(data.breaktimer_parse('') == nil, 'empty cache: nil') assert(data.breaktimer_parse(nil) == nil, 'nil cache: nil') +-- immich_parse: one entry per photo line, place optional, garbage skipped. +local im = data.immich_parse(read('test/fixtures/immich_index')) +assert(im and #im == 3, 'immich photo count, got ' .. tostring(im and #im)) +assert(im[1].year == 2014 and im[1].place == 'Example City, Italy', 'immich first photo') +assert(table.concat(im[1].taken, ' ') == '2014 9 29 19 33', 'immich taken parses') +assert(im.url == 'http://immich.example.org:2283', 'immich url parses') +assert(im[2].place == nil, 'empty place: nil, so the card prints --') +assert(im[3].taken == nil and im[3].place == '40.123, 9.456', 'missing date, coords place') +assert(data.immich_parse('photo a|2014||\n') == nil, 'no generated key: nil') +assert(data.immich_parse(nil) == nil, 'nil index: nil') +local none = data.immich_parse('generated 1\n') +assert(none and #none == 0, 'no memories today: empty list, not nil') + print('test_data: all assertions passed') |
