Skip to content

Commit 111abca

Browse files
committed
feat(assert): Accept byte slices as output predicates
1 parent 49f2c3c commit 111abca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/assert.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,14 @@ where
400400
}
401401
}
402402

403+
impl IntoOutputPredicate<predicates::ord::EqPredicate<&'static [u8]>> for &'static [u8] {
404+
type Predicate = predicates::ord::EqPredicate<&'static [u8]>;
405+
406+
fn into_output(self) -> Self::Predicate {
407+
predicates::ord::eq(self)
408+
}
409+
}
410+
403411
impl IntoOutputPredicate<predicates::str::Utf8Predicate<predicates::str::DifferencePredicate>>
404412
for &'static str
405413
{
@@ -466,6 +474,12 @@ mod test {
466474
assert!(pred.eval(b"Hello" as &[u8]));
467475
}
468476

477+
#[test]
478+
fn into_output_from_bytes() {
479+
let pred = convert_output(b"Hello" as &[u8]);
480+
assert!(pred.eval(b"Hello" as &[u8]));
481+
}
482+
469483
#[test]
470484
fn into_output_from_str() {
471485
let pred = convert_output("Hello");

0 commit comments

Comments
 (0)