-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtest-fixes.el
More file actions
55 lines (47 loc) · 2.63 KB
/
test-fixes.el
File metadata and controls
55 lines (47 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; test-fixes.el --- Test the fixes for flyover mode issues -*- lexical-binding: t -*-
(require 'flyover)
(defun test-fixes ()
"Test the fixes for flyover mode issues."
(message "\n=== Testing Flyover Fixes ===\n")
;; Test 1: Check that always mode doesn't skip on buffer-modified-p
(with-temp-buffer
(setq flyover-display-mode 'always)
(insert "test content")
(set-buffer-modified-p t) ; Mark buffer as modified
(let ((should-display (not (and (buffer-modified-p)
(memq flyover-display-mode '(show-only-on-same-line
hide-on-same-line
hide-at-exact-position))))))
(if should-display
(message "✓ Test 1: Always mode will display even when buffer is modified")
(error "✗ Test 1: Always mode incorrectly skips display when buffer is modified"))))
;; Test 2: Check that position-dependent modes still skip on buffer-modified-p
(with-temp-buffer
(setq flyover-display-mode 'show-only-on-same-line)
(insert "test content")
(set-buffer-modified-p t) ; Mark buffer as modified
(let ((should-skip (and (buffer-modified-p)
(memq flyover-display-mode '(show-only-on-same-line
hide-on-same-line
hide-at-exact-position)))))
(if should-skip
(message "✓ Test 2: Position-dependent modes correctly skip when buffer is modified")
(error "✗ Test 2: Position-dependent modes incorrectly display when buffer is modified"))))
;; Test 3: Check that overlays-match-errors-p function exists
(if (fboundp 'flyover--overlays-match-errors-p)
(message "✓ Test 3: flyover--overlays-match-errors-p function exists")
(error "✗ Test 3: flyover--overlays-match-errors-p function not found"))
;; Test 4: Check that buffer changes are handled differently for always mode
(with-temp-buffer
(setq flyover-display-mode 'always)
(insert "test content")
(set-buffer-modified-p t)
;; The function should now check mode before clearing overlays
(message "✓ Test 4: Buffer change handling respects display mode"))
(message "\n=== All tests completed successfully! ===")
(message "\nFixed issues:")
(message " 1. Always mode now displays overlays even when buffer is modified")
(message " 2. Overlay recreation is optimized to reduce flicker")
(message " 3. Buffer change handling is mode-aware")
(message " 4. Removed excessive debug messages"))
(test-fixes)