Skip to content

Commit 08de000

Browse files
committed
test(stack-encrypt): state the one-part list test through Stated
`check_single` takes a `Stated` since the query and stored contexts split; the test that #1589 added for `testing::list` is written against it here. Refs #1487.
1 parent 369b590 commit 08de000

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎packages/stack-encrypt/src/testing.rs‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,6 @@ mod tests {
618618
Stated::One(parts)
619619
}
620620

621-
/// [`one`], where a local `one` is a tree.
622-
fn one_stated(parts: &[Expect]) -> Stated<'_> {
623-
Stated::One(parts)
624-
}
625-
626621
#[test]
627622
fn a_matching_context_passes() {
628623
check_single(
@@ -636,18 +631,18 @@ mod tests {
636631
/// one part states the bare part, so the list is stated with `list`.
637632
#[test]
638633
fn a_one_part_list_is_stated_with_list() {
639-
let one = ContextTree::List(vec![Expect::from("email").0]);
640-
check_single(&one, one_stated(&[list(["email"])])).unwrap();
641-
let message = check_single(&one, one_stated(&[Expect::from("email")])).unwrap_err();
634+
let one_part = ContextTree::List(vec![Expect::from("email").0]);
635+
check_single(&one_part, one(&[list(["email"])])).unwrap();
636+
let message = check_single(&one_part, one(&[Expect::from("email")])).unwrap_err();
642637
assert!(
643638
message.contains("expected `email`, found `(email)`"),
644639
"{message}"
645640
);
646-
let nested = ContextTree::List(vec![one.clone(), Expect::from(42u64).0]);
647-
check_single(&nested, one_stated(&[list(["email"]), Expect::from(42u64)])).unwrap();
641+
let nested = ContextTree::List(vec![one_part.clone(), Expect::from(42u64).0]);
642+
check_single(&nested, one(&[list(["email"]), Expect::from(42u64)])).unwrap();
648643
let bare = Expect::from("users").0;
649-
check_single(&bare, one_stated(&[Expect::from("users")])).unwrap();
650-
assert!(check_single(&bare, one_stated(&[list(["users"])])).is_err());
644+
check_single(&bare, one(&[Expect::from("users")])).unwrap();
645+
assert!(check_single(&bare, one(&[list(["users"])])).is_err());
651646
}
652647

653648
#[test]

0 commit comments

Comments
 (0)