Pin async function evaluation in expressions and reduce trc::Result size

This commit is contained in:
mdecimus
2025-01-06 12:16:47 +01:00
parent 043b53f3e9
commit 9e69a3201f
24 changed files with 241 additions and 142 deletions

View File

@@ -5,9 +5,9 @@ edition = "2021"
resolver = "2"
[features]
default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "azure", "foundationdb"]
#default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "azure", "foundationdb"]
#default = ["sqlite", "postgres", "mysql", "rocks", "s3", "redis", "foundationdb"]
#default = ["rocks"]
default = ["rocks"]
sqlite = ["store/sqlite"]
foundationdb = ["store/foundation", "common/foundation"]
postgres = ["store/postgres"]

View File

@@ -372,7 +372,7 @@ pub async fn jmap_tests() {
.await;
webhooks::test(&mut params).await;
/*email_query::test(&mut params, delete).await;
email_query::test(&mut params, delete).await;
email_get::test(&mut params).await;
email_set::test(&mut params).await;
email_parse::test(&mut params).await;
@@ -385,7 +385,7 @@ pub async fn jmap_tests() {
mailbox::test(&mut params).await;
delivery::test(&mut params).await;
auth_acl::test(&mut params).await;
auth_limits::test(&mut params).await;*/
auth_limits::test(&mut params).await;
auth_oauth::test(&mut params).await;
event_source::test(&mut params).await;
push_subscription::test(&mut params).await;

View File

@@ -426,15 +426,18 @@ async fn eval_if() {
//println!("============= Testing {:?} ==================", key);
let (_, expected_result) = key.rsplit_once('-').unwrap();
assert_eq!(
IfBlock {
key: key.to_string(),
if_then: vec![IfThen {
expr: Expression::try_parse(&mut config, key.as_str(), &token_map).unwrap(),
then: Expression::from(true),
}],
default: Expression::from(false),
}
.eval(&envelope, &core, 0)
core.eval_if::<Variable, _>(
&IfBlock {
key: key.to_string(),
if_then: vec![IfThen {
expr: Expression::try_parse(&mut config, key.as_str(), &token_map).unwrap(),
then: Expression::from(true),
}],
default: Expression::from(false),
},
&envelope,
0
)
.await
.unwrap()
.to_bool(),
@@ -485,7 +488,7 @@ async fn eval_dynvalue() {
.unwrap_or_else(|| panic!("Missing expect for test {test_name:?}"));
assert_eq!(
String::try_from(if_block.eval(&envelope, &core, 0).await.unwrap()).ok(),
core.eval_if::<String, _>(&if_block, &envelope, 0).await,
expected,
"failed for test {test_name:?}"
);