use super::*; #[test] fn constants_execute_with_exact_decimal_and_optional_values() { let source = r#" type State { Ready, error Broken } const title = "δΈ­ζ–‡πŸ˜€" const alias = title const absent: Text? = null const present: Text? = alias const fraction = 0.1000000000000000000000000000000001 const whole = 2 const decimal_whole: Decimal = whole const minimum = -9223372036854775808 const state: State = Ready const broken = State.Broken size() (out: Int) { out = length(alias) } text() (out: Text) { out = alias } missing() (out: Text?) { out = absent } available() (out: Text?) { out = present } amount() (out: Decimal) { out = fraction + decimal_whole } smallest() (out: Int) { out = minimum } ready() (out: State) { out = state } stop() () { fail(broken) } "#; let assertions = r#" assert_eq!(@size@(), 3); assert_eq!(@text@(), "δΈ­ζ–‡πŸ˜€"); assert_eq!(@missing@(), None); assert_eq!(@available@(), Some(String::from("δΈ­ζ–‡πŸ˜€"))); assert_eq!(@amount@().to_string(), "2.1"); assert_eq!(@smallest@(), i64::MIN); assert_eq!(@ready@(), @State@::Ready); assert!(@stop@().is_err()); "#; for profile in [Profile::Dev, Profile::Release] { let binary = build("constants", source, Some(assertions), profile); let output = Command::new(binary).output().unwrap(); assert!( output.status.success(), "{}", String::from_utf8_lossy(&output.stderr) ); } }