Skip to content

Commit fec4c08

Browse files
committed
test(oracle): add strict combo probes (batch 117), ash-overflow/rounding-nil-divisor/call-process-wd/keymap-edges/dynamic-lexical/macrolet-recursion
One new divergence_combo_strict_* probe file (5 tests) for areas the remote team is actively fixing (ash overflow at 63/64 bits, rounding with nil divisor, call-process with INFILE and working directory, keymap edge cases with remap/ kbd/accessible-keymaps), plus deep combos: dynamic/lexical binding interaction (defvar + lexical-let + symbol-value), and cl-macrolet recursive macros + macroexpand. cargo fmt --all and cargo check --workspace are clean.
1 parent c97cc16 commit fec4c08

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
//! Strict combo oracle probes, batch 117: areas the remote team is actively
2+
//! fixing — ash overflow, rounding nil divisor, call-process working dir,
3+
//! keymap edge cases, plus deep combos: dynamic/lexical binding interaction,
4+
//! defmacro &environment, cl-macrolet recursion, and print-number-table.
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_t1_ash_overflow_and_rounding_nil_divisor() {
13+
return_if_neovm_enable_oracle_proptest_not_set!();
14+
assert_oracle_parity(
15+
r####"
16+
(list (ash 1 63)
17+
(ash 1 64)
18+
(ash most-positive-fixnum 1)
19+
(ash most-positive-fixnum -1)
20+
(ash -1 63)
21+
(ash -1 64)
22+
(condition-case err (floor 5 nil) (wrong-type-argument (car err)))
23+
(condition-case err (ceiling 5 nil) (wrong-type-argument (car err)))
24+
(condition-case err (round 5 nil) (wrong-type-argument (car err)))
25+
(condition-case err (truncate 5 nil) (wrong-type-argument (car err)))
26+
(condition-case err (/ 5 nil) (wrong-type-argument (car err)))
27+
(condition-case err (% 5 nil) (wrong-type-argument (car err))))
28+
"####,
29+
);
30+
}
31+
32+
#[test]
33+
fn div_t1_call_process_working_dir_infile() {
34+
return_if_neovm_enable_oracle_proptest_not_set!();
35+
assert_oracle_parity(
36+
r####"
37+
(let* ((dir (make-temp-file "neo-wd-probe" t))
38+
(infile (expand-file-name "input.txt" dir))
39+
(result nil))
40+
(unwind-protect
41+
(progn
42+
(write-region "hello world" nil infile nil 'silent)
43+
(let ((default-directory (file-name-as-directory dir)))
44+
(with-temp-buffer
45+
(let ((status (call-process shell-file-name infile t nil
46+
shell-command-switch "cat input.txt")))
47+
(setq result (list status (buffer-string) default-directory)))))
48+
(delete-directory dir t))
49+
result)
50+
"####,
51+
);
52+
}
53+
54+
#[test]
55+
fn div_t1_keymap_edge_cases_deep() {
56+
return_if_neovm_enable_oracle_proptest_not_set!();
57+
assert_oracle_parity(
58+
r####"
59+
(let ((map (make-keymap)))
60+
(define-key map "a" 'cmd-a)
61+
(define-key map [?b] 'cmd-b)
62+
(define-key map (kbd "C-c C-c") 'cmd-cc)
63+
(define-key map [remap other-cmd] 'remapped)
64+
(list (where-is-internal 'cmd-a map t)
65+
(where-is-internal 'cmd-b map t)
66+
(where-is-internal 'cmd-cc map t)
67+
(command-remapping 'other-cmd nil (list map))
68+
(lookup-key map "a")
69+
(lookup-key map [?b])
70+
(lookup-key map "\C-c\C-c")
71+
(length (accessible-keymaps map))
72+
(eq (lookup-key map [remap other-cmd]) 'remapped)))
73+
"####,
74+
);
75+
}
76+
77+
#[test]
78+
fn div_t1_dynamic_lexical_binding_interaction() {
79+
return_if_neovm_enable_oracle_proptest_not_set!();
80+
assert_oracle_parity(
81+
r####"
82+
(progn
83+
(defvar probe-dyn-var 'dynamic)
84+
(list (let ((probe-dyn-var 'let-bound))
85+
probe-dyn-var)
86+
(let ((probe-dyn-var 'let-bound))
87+
(symbol-value 'probe-dyn-var))
88+
(lexical-let ((probe-lex-var 'lexical))
89+
(list probe-lex-var
90+
(condition-case err (symbol-value 'probe-lex-var)
91+
(void-variable 'void))))
92+
(let ((probe-dyn-var 'outer))
93+
(lexical-let ((probe-lex-var 'lex))
94+
(list probe-dyn-var probe-lex-var)))))
95+
"####,
96+
);
97+
}
98+
99+
#[test]
100+
fn div_t1_cl_macrolet_recursive_and_environment() {
101+
return_if_neovm_enable_oracle_proptest_not_set!();
102+
assert_oracle_parity(
103+
r####"
104+
(list (cl-macrolet ((my-if (c t e)
105+
`(cond (,c ,t)
106+
(t ,e))))
107+
(my-if (> 3 2) 'yes 'no))
108+
(cl-macrolet ((count-down (n)
109+
(if (<= n 0)
110+
''done
111+
`(progn
112+
,n
113+
(count-down ,(1- n)))))
114+
(count-down 3))
115+
(macroexpand '(cl-macrolet ((double (x) `(* 2 ,x)))
116+
(double 5))))
117+
"####,
118+
);
119+
}

neovm-oracle-tests/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,7 @@ mod divergence_combo_stress_overlay_regex_undo;
23012301
mod divergence_combo_strict_addfunc_boolvector_flatten_seqlet_fillprefix;
23022302
mod divergence_combo_strict_advice_macrolet_formatseconds;
23032303
mod divergence_combo_strict_arith_float_time_syntax;
2304+
mod divergence_combo_strict_ash_overflow_rounding_nil_divisor_working_dir_deep;
23042305
mod divergence_combo_strict_async_process_filter_plist_buffer;
23052306
mod divergence_combo_strict_async_process_filter_sentinel_coding_pipe;
23062307
mod divergence_combo_strict_async_process_lines_send_eof_query_env;

0 commit comments

Comments
 (0)