Macro assert_dir_eq

Source
macro_rules! assert_dir_eq {
    ($dir: expr, $expected_structure: expr) => { ... };
    ($dir: expr, $expected_structure: expr, $($arg:tt)+) => { ... };
}
Expand description

Compare a directory against a string representing its expected structure or against another directory.

When comparing against a string, the string must be formatted as:

  • one line per file or directory
  • each line starts with a number of * representing the entry depth
  • directories must end with a / (i.e.: * folder/)
  • order rules are:
    • directories then files
    • alphanumeric order (i.e.: ‘20’ comes before ‘3’)

Example:

assert_dir_eq!(
  &path,
  "* folder_1/
   ** file_1
   ** file_2
   ** subfolder/
   *** subfolder_file
   * file"
);