pub fn load_fixtures(path: &Path) -> Result<TestFixtures, Error> {
    let mut test_fixtures = TestFixtures::new();

    for entry in fs::read_dir(path)? {
        let entry = entry?;

        if !entry.metadata()?.is_dir() {
            continue;
        }

        let dir_entries = match entry.path().file_name() {
            Some(file_name) if file_name == ABI_TEST_FIXTURES => {
                utils::recursive_read_dir(&entry.path())?
            }
            None | Some(_) => continue,
        };

        for dir_entry in dir_entries {
            let dir_entry_path = dir_entry.path();
            let fixture = load_fixture(dir_entry_path.clone())?;
            let filename = dir_entry_path
                .file_stem()
                .and_then(OsStr::to_str)
                .ok_or_else(|| Error::NoStem(dir_entry_path.clone()))?;
            test_fixtures.push(Fixture::ABI {
                name: filename.to_string(),
                fixture,
            });
        }
    }
    Ok(test_fixtures)
}
/// Loads fixtures from a directory.
Loads fixtures from a directory.
Loads fixtures from a directory .
pub fn load_fixtures(path: &Path) -> Result<TestFixtures, Error> {
    let mut test_fixtures = TestFixtures::new();
    for entry in fs::read_dir(path)? {
        let entry = entry?;
        if !entry.metadata()?.is_dir() {
            continue;
        }
        let dir_entries = match entry.path().file_name() {
            Some(file_name) if file_name == ABI_TEST_FIXTURES => {
                utils::recursive_read_dir(&entry.path())?
            }
            None | Some(_) => continue,
        };
        for dir_entry in dir_entries {
            let dir_entry_path = dir_entry.path();
            let fixture = load_fixture(dir_entry_path.clone())?;
            let filename = dir_entry_path
                .file_stem()
                .and_then(OsStr::to_str)
                .ok_or_else(|| Error::NoStem(dir_entry_path.clone()))?;
            test_fixtures.push(Fixture::ABI {
                name: filename.to_string(),
                fixture,
            });
        }
    }
    Ok(test_fixtures)
}
pub fn load_fixtures ( path : & Path ) -> Result < TestFixtures , Error > { let mut test_fixtures = TestFixtures :: new ( ) ; for entry in fs :: read_dir ( path ) ? { let entry = entry ? ; if ! entry . metadata ( ) ? . is_dir ( ) { continue ; } let dir_entries = match entry . path ( ) . file_name ( ) { Some ( file_name ) if file_name == ABI_TEST_FIXTURES => { utils :: recursive_read_dir ( & entry . path ( ) ) ? } None | Some ( _ ) => continue , } ; for dir_entry in dir_entries { let dir_entry_path = dir_entry . path ( ) ; let fixture = load_fixture ( dir_entry_path . clone ( ) ) ? ; let filename = dir_entry_path . file_stem ( ) . and_then ( OsStr :: to_str ) . ok_or_else ( | | Error :: NoStem ( dir_entry_path . clone ( ) ) ) ? ; test_fixtures . push ( Fixture :: ABI { name : filename . to_string ( ) , fixture , } ) ; } } Ok ( test_fixtures ) }
Loads fixtures from a directory.
Loads fixtures from a directory .
path
&Path
path
&Path