Files
gridcraft/crates/engine/tests/it/percent_entry.rs
T
aiongg a7608ada6d CI: one test binary per crate, nextest, line tables only (#2372)
* CI: dev builds keep line tables only

* CI: one integration-test binary per crate

* CI: xtask runs tests with nextest, doctests apart, --keep-going on clippy and wasm

cargo xtask test runs the workspace tests (--lib --bins --tests) with cargo-nextest when it is installed, else cargo test, then the doctests. cargo xtask ci uses the same two steps.

* CI: docs name cargo xtask test

* CI: agent guides name the moved fuzz test

* CI: tests added on main join their crate's test binary
2026-10-23 12:59:46 -04:00

21 lines
731 B
Rust

//! Typing a bare number into a Percentage-formatted cell enters it as a percent (issue #1967).
use gridcraft_engine::display::cell_text;
use serde_json::json;
fn enter(input: &str) -> String {
let mut s = gridcraft_engine::Session::new();
s.new_workbook();
s.execute("home.numberFormat", json!({"range": "A1", "format": "Percentage"})).unwrap();
s.execute("cell.set", json!({"cell": "A1", "input": input})).unwrap();
let d = s.doc().unwrap();
cell_text(&d.wb, d.wb.active().unwrap(), gridcraft_engine::core::CellRef::new(0, 0))
}
#[test]
fn bare_number_in_percent_cell_is_a_percent() {
assert_eq!(enter("3"), "3.00%");
assert_eq!(enter("0.03"), "3.00%");
assert_eq!(enter("3%"), "3.00%");
}