Skip to content

Commit 6727a54

Browse files
tidy
Signed-off-by: John Kastner <[email protected]>
1 parent eb34d28 commit 6727a54

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cedar-policy-core/src/extensions/ipaddr.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ mod tests {
10331033
let entities = basic_entities();
10341034
let eval = Evaluator::new(request, &entities, &exts);
10351035

1036-
// Requires at least one argument.
1036+
// Requires exactly two arguments
10371037
assert_ipaddr_wrong_num_args_err(
10381038
eval.interpret_inline_policy(&Expr::call_extension_fn(
10391039
Name::parse_unqualified_name("isInRange").expect("should be a valid identifier"),
@@ -1046,6 +1046,15 @@ mod tests {
10461046
)),
10471047
"isInRange",
10481048
);
1049+
assert_ipaddr_wrong_num_args_err(
1050+
eval.interpret_inline_policy(&Expr::call_extension_fn(
1051+
Name::parse_unqualified_name("isInRange").expect("should be a valid identifier"),
1052+
vec![
1053+
ip("192.168.1.100"),
1054+
],
1055+
)),
1056+
"isInRange",
1057+
);
10491058
}
10501059

10511060
#[test]

cedar-policy-core/src/validator/typecheck/test/extensions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ fn ip_extension_typecheck_fails() {
9898
);
9999
}
100100

101-
#[cfg(not(feature = "variadic-is-in-range"))]
102101
#[test]
102+
#[cfg(not(feature = "variadic-is-in-range"))]
103103
fn ip_extension_not_variadic() {
104104
let src = "ip(\"127.0.0.1\").isInRange(ip(\"192.168.0.1/24\"), ip(\"192.167.0.1/24\"), ip(\"192.167.0.3/24\"))";
105105
let expr = Expr::from_str(src).expect("parsing should succeed");
@@ -111,8 +111,8 @@ fn ip_extension_not_variadic() {
111111
);
112112
}
113113

114-
#[cfg(feature = "variadic-is-in-range")]
115114
#[test]
115+
#[cfg(feature = "variadic-is-in-range")]
116116
fn ip_extension_variadic() {
117117
use crate::ast::Name;
118118
let ipaddr_name = Name::parse_unqualified_name("ipaddr").expect("should be a valid identifier");

0 commit comments

Comments
 (0)