aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_weather.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_weather.lua b/test/test_weather.lua
index 87e787a..f61fa22 100644
--- a/test/test_weather.lua
+++ b/test/test_weather.lua
@@ -62,4 +62,19 @@ assert(icon(804, DAY) == weather.ICON.overcast, 'id 804 is overcast')
assert(icon(999, DAY) == weather.ICON.unknown, 'unknown id gets the error glyph')
assert(weather.icon(nil, DAY, 1500, 1900) == weather.ICON.unknown, 'nil id')
+-- Nothing may raise. A missing timestamp with a known sun, or a known
+-- timestamp with no sun, both have to return a glyph rather than an error,
+-- because an error here is a blank dashboard with no message.
+assert(weather.icon(800, nil, 1500, 1900) == weather.ICON.clear_day,
+ 'a nil now must not raise, and falls back to the day face')
+assert(weather.icon(800, DAY, nil, nil) == weather.ICON.clear_day,
+ 'no sun times must not raise')
+
+-- The codepoint VALUES are deliberately not asserted. A test comparing
+-- M.ICON.snow against a literal would only prove the same escape was typed
+-- twice; whether E31A actually draws a snow cloud in the target font is not
+-- something an assertion can see. That check is the glyph sheet rendered in
+-- the plan's Step 5, and it is how a wrong-but-present codepoint was caught
+-- before this file existed.
+
print('test_weather: all assertions passed')