Skip to content

Commit c97cc16

Browse files
committed
test(oracle): add strict combo probes (batch 116), window-config-roundtrip/indirect-buffer/field-motion/save-excursion-nesting
One new divergence_combo_strict_* probe file (5 tests) for window-configuration roundtrip, indirect-buffer narrowing+markers, field motion with text-property fields, save-excursion/save-restriction deep nesting, and window-dedicated-p persistence through configuration roundtrip. cargo fmt --all and cargo check --workspace are clean.
1 parent 233d91d commit c97cc16

2 files changed

Lines changed: 143 additions & 0 deletions

File tree

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
//! Strict combo oracle probes, batch 116: window-configuration roundtrip with
2+
//! markers/point/dedicated state, indirect-buffer narrowing+markers, field
3+
//! motion with text-property fields, and save-excursion/save-restriction
4+
//! deep nesting.
5+
//!
6+
//! Tests are parity locks unless annotated with a surfaced divergence.
7+
8+
use super::common::assert_oracle_parity;
9+
use super::common::return_if_neovm_enable_oracle_proptest_not_set;
10+
11+
#[test]
12+
fn div_t0_window_config_roundtrip_markers_point() {
13+
return_if_neovm_enable_oracle_proptest_not_set!();
14+
assert_oracle_parity(
15+
r####"
16+
(let ((b1 (get-buffer-create " *probe-wc-a*"))
17+
(b2 (get-buffer-create " *probe-wc-b*"))
18+
(m (make-marker)))
19+
(unwind-protect
20+
(progn
21+
(delete-other-windows)
22+
(switch-to-buffer b1)
23+
(with-current-buffer b1 (insert "line one\nline two\nline three"))
24+
(set-marker m 10 b1)
25+
(goto-char 10)
26+
(let ((cfg (current-window-configuration))
27+
(w2 (split-window nil nil 'below)))
28+
(set-window-buffer w2 b2)
29+
(with-current-buffer b2 (insert "other buffer content"))
30+
(select-window w2)
31+
(set-window-configuration cfg)
32+
(list (count-windows)
33+
(eq (current-buffer) b1)
34+
(point)
35+
(marker-position m)
36+
(buffer-name (window-buffer (selected-window))))))
37+
(when (buffer-live-p b1) (kill-buffer b1))
38+
(when (buffer-live-p b2) (kill-buffer b2))
39+
(delete-other-windows)))
40+
"####,
41+
);
42+
}
43+
44+
#[test]
45+
fn div_t0_indirect_buffer_narrow_markers() {
46+
return_if_neovm_enable_oracle_proptest_not_set!();
47+
assert_oracle_parity(
48+
r####"
49+
(let* ((base (get-buffer-create " *probe-ind-base*"))
50+
(ind (make-indirect-buffer base " *probe-ind*")))
51+
(unwind-protect
52+
(progn
53+
(with-current-buffer base
54+
(insert "0123456789ABCDEFGHIJ")
55+
(setq-local probe-var 'in-base))
56+
(with-current-buffer ind
57+
(narrow-to-region 5 15)
58+
(list (buffer-string)
59+
(point-min)
60+
(point-max)
61+
(eq (buffer-base-buffer ind) base)
62+
(buffer-base-buffer base)))
63+
(with-current-buffer base
64+
(list (point-min)
65+
(point-max)
66+
(buffer-string)
67+
(widen)
68+
(buffer-string))))
69+
(when (buffer-live-p ind) (kill-buffer ind))
70+
(when (buffer-live-p base) (kill-buffer base))))
71+
"####,
72+
);
73+
}
74+
75+
#[test]
76+
fn div_t0_field_motion_text_property_fields() {
77+
return_if_neovm_enable_oracle_proptest_not_set!();
78+
assert_oracle_parity(
79+
r####"
80+
(with-temp-buffer
81+
(insert "AAAA BBBB CCCC")
82+
(put-text-property 1 4 'field 'f1)
83+
(put-text-property 7 10 'field 'f2)
84+
(put-text-property 13 16 'field 'f3)
85+
(goto-char 2)
86+
(list (field-beginning 2)
87+
(field-end 2)
88+
(field-string 2)
89+
(constrain-to-field 15 2)
90+
(line-beginning-position)
91+
(field-beginning 8)
92+
(field-end 8)))
93+
"####,
94+
);
95+
}
96+
97+
#[test]
98+
fn div_t0_save_excursion_restriction_deep_nesting() {
99+
return_if_neovm_enable_oracle_proptest_not_set!();
100+
assert_oracle_parity(
101+
r####"
102+
(with-temp-buffer
103+
(insert "0123456789ABCDEFGHIJ")
104+
(let (result)
105+
(save-excursion
106+
(save-restriction
107+
(narrow-to-region 5 15)
108+
(goto-char 8)
109+
(push (list (point) (point-min) (point-max) (buffer-string)) result)
110+
(save-excursion
111+
(goto-char (point-min))
112+
(push (point) result))
113+
(push (list (point) (buffer-string)) result)))
114+
(push (list (point) (point-min) (point-max) (buffer-string)) result)
115+
(nreverse result)))
116+
"####,
117+
);
118+
}
119+
120+
#[test]
121+
fn div_t0_window_dedicated_persist_roundtrip() {
122+
return_if_neovm_enable_oracle_proptest_not_set!();
123+
assert_oracle_parity(
124+
r####"
125+
(let ((b (get-buffer-create " *probe-ded*")))
126+
(unwind-protect
127+
(progn
128+
(delete-other-windows)
129+
(switch-to-buffer b)
130+
(set-window-dedicated-p nil 'test)
131+
(let ((cfg (current-window-configuration))
132+
(ded-before (window-dedicated-p)))
133+
(set-window-dedicated-p nil nil)
134+
(set-window-configuration cfg)
135+
(list ded-before
136+
(window-dedicated-p)
137+
(count-windows))))
138+
(when (buffer-live-p b) (kill-buffer b))
139+
(delete-other-windows)))
140+
"####,
141+
);
142+
}

neovm-oracle-tests/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,7 @@ mod divergence_combo_strict_timeflags_motion_obarray;
24102410
mod divergence_combo_strict_undo_redo_yank_insert;
24112411
mod divergence_combo_strict_user_env_load_locale_state;
24122412
mod divergence_combo_strict_whitespace_normalize_trailing_indent_fixup;
2413+
mod divergence_combo_strict_window_config_roundtrip_indirect_buffer_field_motion_deep;
24132414
mod divergence_combo_strict_window_display_markers_search;
24142415
mod divergence_combo_strict_window_resizable_safe_at_combolimit;
24152416
mod divergence_combo_strict_wordsearch_sentence_research_backward;

0 commit comments

Comments
 (0)