iocore-test 3.2.0

IOCore is a safe library for unix CLI tools and Systems programming. IOCore provides the [`iocore::Path`] abstraction of file-system paths designed to replace most [`std::path`] and [`std::fs`] operations with practical methods, other abstractions include: - handling file-system permissions via [`iocore::PathPermissions`] powered by the crate [`trilobyte`]. - handling file-system timestamps via [`iocore::PathTimestamps`] granularly via [`iocore::PathDateTime`]. IOCore provides the [`iocore::walk_dir`] function and its companion trait [`iocore::WalkProgressHandler`] which traverses file-systems quickly via threads. IOcore provides [`iocore::User`] which provides unix user information such as uid, path to home etc. The module [`iocore::env`] provides [`iocore::env:args`] returns a [`Vec<String>`] from [`std::env:args`], and [`iocore::env:var`] that returns environment variables as string.
Documentation
use k9::assert_equal;
use iocore::{Path, Result};
use iocore_test::{
    current_source_file, folder_path, path_to_test_file, path_to_test_folder, seq_bytes,
};

#[test]
fn test_path_to_test_file() -> Result<()> {
    let path = path_to_test_file!("test_path_to_test_file").write(&[])?;
    assert!(path.exists());
    assert!(path.is_file());
    Ok(())
}
#[test]
fn test_path_to_test_folder() -> Result<()> {
    path_to_test_folder!("test_path_to_test_folder").mkdir()?;
    assert!(path_to_test_folder!("test_path_to_test_folder").is_directory());
    Ok(())
}

#[test]
fn test_seq_bytes() -> Result<()> {
    assert_equal!(seq_bytes(10), vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
    Ok(())
}

#[test]
fn test_folder_path() -> Result<()> {
    assert_equal!(folder_path!(), Path::new(current_source_file!()).parent().unwrap());
    assert_equal!(folder_path!("test.rs"), Path::new(current_source_file!()));
    Ok(())
}