functions: keep DATEDIF's original description, add the units

Restores "Counts whole years, months or days between two dates." and
appends the units, in the multi-line form rustfmt gives a long entry.

Drops the 256-argument test case: the parser already refuses more than
255 arguments, so it never reached the entry check. (993c108's message
says entry "also refuses" them; it already did.)

Claude-Session: https://claude.ai/code/session_01BGBBGBC2gRpQ7GDuwQ6WPt
This commit is contained in:
Shirish Veerabattini
2026-10-11 15:57:33 -05:00
parent 1d1d27f9a4
commit 478f01d236
2 changed files with 10 additions and 7 deletions
-6
View File
@@ -219,12 +219,6 @@ fn formulas_with_the_wrong_argument_count_are_refused_on_entry() {
assert!(e.contains(&format!("too {word} arguments")), "{input}: {e}");
assert_eq!(v(&s, "A1"), Value::text("kept"), "{input} must not replace the cell");
}
// Excel's 255-argument limit applies to variadic functions too.
let many = format!("=SUM({})", vec!["1"; 256].join(","));
let e = s.execute("cell.set", json!({"cell": "A1", "input": many})).unwrap_err().to_string();
assert!(e.contains("too many arguments"), "{e}");
s.execute("cell.set", json!({"cell": "A2", "input": format!("=SUM({})", vec!["1"; 255].join(","))})).unwrap();
assert_eq!(v(&s, "A2"), Value::Number(255.0));
let e = s.execute("cell.set", json!({"cell": "A1", "input": "=DATEDIF(1,2)"})).unwrap_err().to_string();
assert!(e.contains("DATEDIF(start_date, end_date, unit)"), "{e}");
// Correct counts, optional arguments left empty, special forms, LAMBDA names and unknown