Skip to content

Commit

Permalink
Sarthak | Incorporates feedback on matcher documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SarthakMakhija committed Jan 15, 2024
1 parent baf4acc commit 1bdc3fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/matchers/bool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::matchers::{Matcher, MatcherResult};
///
/// # Example
///```
/// use clearcheck::matchers::bool::{be_true, TrueFalseMatcher};
/// use clearcheck::matchers::bool::be_true;
/// use clearcheck::matchers::Matcher;
///
/// let matcher = be_true();
Expand Down
35 changes: 17 additions & 18 deletions src/matchers/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@ use walkdir::WalkDir;
use crate::matchers::{Matcher, MatcherResult};

/// FileTypeMatcher offers a flexible way to make assertions about various file type properties like: regular file, directory, symbolic link etc.
///
/// # Example
///```
/// use std::fs::File;
/// use tempdir::TempDir;
/// use clearcheck::matchers::file::contain_file_name;
/// use clearcheck::matchers::Matcher;
///
/// let temporary_directory = TempDir::new(".").unwrap();
/// let file_path = temporary_directory.path().join("clearcheck.txt");
///
/// let _ = File::create(file_path).unwrap();
///
/// let directory_path = temporary_directory.path();
/// let matcher = contain_file_name("clearcheck.txt");
///
/// assert!(matcher.test(&directory_path).passed());
/// ```
pub enum FileTypeMatcher {
File,
Directory,
Expand All @@ -44,6 +26,23 @@ pub enum FilePathMatcher {
}

/// TreeMatcher offers a flexible way to make assertions about presence or absence of files or directories within a tree structure.
/// # Example
///```
/// use std::fs::File;
/// use tempdir::TempDir;
/// use clearcheck::matchers::file::contain_file_name;
/// use clearcheck::matchers::Matcher;
///
/// let temporary_directory = TempDir::new(".").unwrap();
/// let file_path = temporary_directory.path().join("clearcheck.txt");
///
/// let _ = File::create(file_path).unwrap();
///
/// let directory_path = temporary_directory.path();
/// let matcher = contain_file_name("clearcheck.txt");
///
/// assert!(matcher.test(&directory_path).passed());
/// ```
pub enum TreeMatcher {
Contain(&'static str),
ContainAll(Vec<&'static str>),
Expand Down

0 comments on commit 1bdc3fa

Please sign in to comment.