test.test(-0.99, [" -.99", " -1.0"], ["-0.99", " -1.0"]);
test.test(-0.01, [" -.01", " .0"], ["-0.01", " 0.0"]);
}
+
+ #[test]
+ fn non_ascii_cc() {
+ fn test(settings: &Settings, value: f64, expected: &str) {
+ assert_eq!(
+ &Value::from(value)
+ .display(Format::new(Type::CC(CC::A), 10, 2).unwrap(), UTF_8)
+ .with_settings(settings)
+ .to_string(),
+ expected
+ );
+ }
+
+ let settings = Settings::default().with_cc(CC::A, "«,¥,€,»".parse().unwrap());
+ test(&settings, 1.0, " ¥1.00€ ");
+ test(&settings, -1.0, " «¥1.00€»");
+ test(&settings, 1.5, " ¥1.50€ ");
+ test(&settings, -1.5, " «¥1.50€»");
+ test(&settings, 0.75, " ¥.75€ ");
+ test(&settings, 1.5e10, " ¥2E+010€ ");
+ test(&settings, -1.5e10, "«¥2E+010€»");
+ }
}