Skip to content

Commit 3a7d53f

Browse files
committed
ok
Signed-off-by: Shaobo He <[email protected]>
1 parent 02d6f9d commit 3a7d53f

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

cedar-policy-symcc/src/symcc/compiler.rs

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ mod decimal_tests {
723723
use cedar_policy_core::ast::Name;
724724

725725
use cedar_policy::{RequestEnv, Schema};
726-
use cool_asserts::{assert_matches, assert_panics};
726+
use cool_asserts::assert_matches;
727727

728728
use crate::symcc::{extension_types::decimal::Decimal, result::CompileError};
729729

@@ -794,12 +794,11 @@ mod decimal_tests {
794794
#[track_caller]
795795
fn test_invalid(str: &str, msg: &str) {
796796
let sym_env = SymEnv::new(&decimal_schema(), &request_env()).expect("Malformed sym env.");
797-
assert_panics!(
798-
assert_matches!(
799-
compile(&dec_lit(str), &sym_env),
800-
Err(CompileError::TypeError),
801-
),
802-
includes(msg)
797+
assert_matches!(
798+
compile(&dec_lit(str), &sym_env),
799+
Err(CompileError::ExtError(_)),
800+
"{}",
801+
msg
803802
);
804803
}
805804

@@ -836,12 +835,11 @@ mod decimal_tests {
836835
test_invalid("922337203685477.5808", "overflow");
837836
test_invalid("-922337203685477.5809", "overflow");
838837
let s = Expr::get_attr(Expr::var(Var::Context), "s".into());
839-
assert_panics!(
840-
assert_matches!(
841-
compile(&dec_expr(s), &sym_env()),
842-
Err(CompileError::TypeError),
843-
),
844-
includes("Error: applying decimal constructor to a non-literal")
838+
assert_matches!(
839+
compile(&dec_expr(s), &sym_env()),
840+
Err(CompileError::TypeError),
841+
"{}",
842+
"Error: applying decimal constructor to a non-literal"
845843
);
846844
}
847845

@@ -870,7 +868,7 @@ mod datetime_tests {
870868
use cedar_policy_core::ast::Name;
871869

872870
use cedar_policy::{RequestEnv, Schema};
873-
use cool_asserts::{assert_matches, assert_panics};
871+
use cool_asserts::assert_matches;
874872

875873
use crate::symcc::{
876874
extension_types::datetime::{Datetime, Duration},
@@ -972,12 +970,11 @@ mod datetime_tests {
972970
#[track_caller]
973971
fn test_invalid_datetime_constructor(str: &str, msg: &str) {
974972
let sym_env = SymEnv::new(&datetime_schema(), &request_env()).expect("Malformed sym env.");
975-
assert_panics!(
976-
assert_matches!(
977-
compile(&datetime_lit(str), &sym_env),
978-
Err(CompileError::ExtError(_)),
979-
),
980-
includes(msg)
973+
assert_matches!(
974+
compile(&datetime_lit(str), &sym_env),
975+
Err(CompileError::ExtError(_)),
976+
"{}",
977+
msg
981978
);
982979
}
983980

@@ -995,12 +992,11 @@ mod datetime_tests {
995992
#[track_caller]
996993
fn test_invalid_duration_constructor(str: &str, msg: &str) {
997994
let sym_env = SymEnv::new(&duration_schema(), &request_env()).expect("Malformed sym env.");
998-
assert_panics!(
999-
assert_matches!(
1000-
compile(&duration_lit(str), &sym_env),
1001-
Err(CompileError::TypeError),
1002-
),
1003-
includes(msg)
995+
assert_matches!(
996+
compile(&duration_lit(str), &sym_env),
997+
Err(CompileError::ExtError(_)),
998+
"{}",
999+
msg
10041000
);
10051001
}
10061002

0 commit comments

Comments
 (0)