fix: ignore underscore in input

I accidentally removed this before... oops :3
This commit is contained in:
electria 2026-10-23 22:18:05 -07:00
commit c74abdace3
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -4,6 +4,7 @@ use crate::nodes::{self, Error};
pub fn pretty_eval(input: &str, max_digits: usize) -> Result<String, Error> {
let (prefix, deliminator, input) = input.rsplit_once_last(&["= ", "& ", "plus.minus "]);
let input = input.replace('_', "");
// no need to remove the character here,
// as we ignore it in all other logic already
@ -134,6 +135,11 @@ mod tests {
assert_pretty_eval!("plus.minus 5 & = 5");
}
#[test]
fn underscore_input() {
assert_pretty_eval!("10_000 * 10_000 * 4", "4 * 10^8")
}
#[test]
fn basic_get_significant_digits() {
let many_zeros = eval("14.00643 + 1.00784 * 4 + 35.446 + 15.9994 * 4");