2024-01-06 07:26:51 +00:00
|
|
|
use dust_lang::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn args() {
|
|
|
|
assert!(interpret("args").is_ok_and(|value| value.is_list()));
|
|
|
|
}
|
2024-02-15 08:57:13 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn assert_equal() {
|
|
|
|
assert_eq!(
|
|
|
|
interpret("assert_equal"),
|
|
|
|
Ok(Value::Function(Function::BuiltIn(
|
|
|
|
BuiltInFunction::AssertEqual
|
|
|
|
)))
|
|
|
|
);
|
|
|
|
assert_eq!(
|
|
|
|
interpret("assert_equal(false, false)"),
|
|
|
|
Ok(Value::Enum(EnumInstance::new(
|
|
|
|
"Result".to_string(),
|
|
|
|
"Ok".to_string(),
|
|
|
|
Value::none()
|
|
|
|
)))
|
|
|
|
);
|
|
|
|
assert_eq!(
|
|
|
|
interpret("assert_equal(true, false)"),
|
|
|
|
Ok(Value::Enum(EnumInstance::new(
|
|
|
|
"Result".to_string(),
|
|
|
|
"Error".to_string(),
|
|
|
|
Value::none()
|
|
|
|
)))
|
|
|
|
);
|
|
|
|
}
|