summaryrefslogtreecommitdiff
path: root/tests/fixtures/test-init.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-08 11:53:02 -0600
committerCraig Jennings <c@cjennings.net>2025-11-08 11:53:02 -0600
commit1f40ef408641680c951a65b72be240d9b7729d8e (patch)
tree083ae2d5ecf73134311233152f9dacc3f125fb77 /tests/fixtures/test-init.el
parentb44277b019ac64ffeacde0214cd3c9cd18014ba9 (diff)
feat: debug: add comprehensive debug logging and integration tests
Enhanced wttrin-debug.el: - Added wttrin--debug-log() function for timestamped logging - Added wttrin--debug-clear-log() to clear log - Added wttrin--debug-show-log() to display log in buffer - Debug log structure: list of (timestamp . message) pairs Added debug logging to key functions in wttrin.el: - wttrin--fetch-url: Logs start, success (bytes), and errors - wttrin--mode-line-fetch-weather: Logs start, URL, data received - wttrin--mode-line-update-display: Logs display update, emoji extraction Created comprehensive integration tests: - test-wttrin-integration-with-debug.el (5 tests, 3 passing) - Tests fetch, mode-line display, error handling with debug logging - Includes mocked network calls to avoid external dependencies - Example debug output shows complete flow: [wttrin-debug 11:51:46.490] mode-line-fetch: Starting fetch for Berkeley, CA [wttrin-debug 11:51:46.490] mode-line-fetch: Received data = "Berkeley, CA: ☀️ +62°F Clear" [wttrin-debug 11:51:46.490] mode-line-display: Extracted emoji = "☀", font = Noto Color Emoji [wttrin-debug 11:51:46.490] mode-line-display: Complete. mode-line-string set = YES Added test fixtures: - tests/fixtures/test-init.el: Minimal config with debug enabled - tests/README-DEBUG-TESTS.md: Documentation for using debug features Usage: (setq wttrin-debug t) ; Before loading wttrin (require 'wttrin) M-x wttrin--debug-show-log ; View all logged events This provides complete visibility into wttrin's operation for troubleshooting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'tests/fixtures/test-init.el')
-rw-r--r--tests/fixtures/test-init.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/fixtures/test-init.el b/tests/fixtures/test-init.el
new file mode 100644
index 0000000..26e8395
--- /dev/null
+++ b/tests/fixtures/test-init.el
@@ -0,0 +1,22 @@
+;;; test-init.el --- Test fixture for wttrin integration tests -*- lexical-binding: t; -*-
+
+;; This is a minimal init.el for testing wttrin with debug enabled
+
+;; Enable debug mode BEFORE loading wttrin
+(setq wttrin-debug t)
+
+;; Configure wttrin
+(setq wttrin-default-locations '("Berkeley, CA" "New Orleans, LA"))
+(setq wttrin-unit-system "m") ; Metric
+(setq wttrin-mode-line-favorite-location "Berkeley, CA")
+(setq wttrin-mode-line-startup-delay 0) ; No delay for tests
+(setq wttrin-mode-line-refresh-interval 3600) ; 1 hour
+
+;; Load wttrin (assumes it's in load-path)
+(require 'wttrin)
+
+;; Don't auto-enable mode-line in tests (we'll do it explicitly)
+(setq wttrin-mode-line-auto-enable nil)
+
+(provide 'test-init)
+;;; test-init.el ends here