diff options
Diffstat (limited to 'test_util/src')
-rw-r--r-- | test_util/src/assertions.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test_util/src/assertions.rs b/test_util/src/assertions.rs index a004530b6..29066ded0 100644 --- a/test_util/src/assertions.rs +++ b/test_util/src/assertions.rs @@ -1,6 +1,16 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. #[macro_export] +macro_rules! assert_starts_with { + ($string:expr, $($test:expr),+) => { + let string = $string; // This might be a function call or something + if !($(string.starts_with($test))||+) { + panic!("{:?} does not start with {:?}", string, [$($test),+]); + } + } +} + +#[macro_export] macro_rules! assert_ends_with { ($left:expr, $right:expr $(,)?) => { match (&$left, &$right) { |