mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-27 20:26:48 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user