Dever v0.0.2

This commit is contained in:
Codex committed 2026-11-27 06:03:56 +00:00
commit e6e175ebcf
816 files changed
+120349

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
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)
);
}
}