macro_rules! filecheck {
($input:expr, $checks:expr) => { ... };
($input:expr, $checks:expr, $config:expr) => { ... };
}Expand description
Use filecheck in a Rust test directly against an input value that implements Display.
ยงExample
#![expect(unstable_name_collisions)]
use litcheck_filecheck::filecheck;
use itertools::Itertools;
let original = "abbc";
let modified = original.chars().intersperse('\n').collect::<String>();
filecheck!(modified, "
; CHECK: a
; CHECK-NEXT: b
; CHECK-NEXT: b
; CHECK-NEXT: c
");If custom configuration is desired, you may instantiate the filecheck configuration (see
Config) and pass it as an additional parameter:
#![expect(unstable_name_collisions)]
use litcheck_filecheck::{filecheck, Config, Options};
use itertools::Itertools;
let original = "abbc";
let modified = original.chars().intersperse('\n').collect::<String>();
let config = Config {
options: Options {
match_full_lines: true,
..Options::default()
},
..Config::default()
};
filecheck!(modified, "
; CHECK: a
; CHECK-NEXT: b
; CHECK-NEXT: b
; CHECK-NEXT: c
");If successful, the filecheck! macro returns the pattern matches produced by verifying the
checks, allowing you to examine them in more detail.