-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
065d7d8
commit 49482c1
Showing
5 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::fs::{self, File}; | ||
use std::io::Write; | ||
use tempfile; | ||
|
||
use crate::{get_content, get_download_dir, run_sorting}; | ||
|
||
#[test] | ||
fn test_get_download_dir() { | ||
let result = get_download_dir(); | ||
assert!(result.is_ok()); | ||
} | ||
|
||
#[test] | ||
fn test_get_content() { | ||
let temp_dir = tempfile::tempdir().unwrap(); | ||
let temp_path = temp_dir.path().to_path_buf(); | ||
File::create(temp_path.join("testfile.txt")).unwrap(); | ||
|
||
let result = get_content(&temp_path); | ||
assert!(result.is_ok()); | ||
} | ||
|
||
#[test] | ||
fn test_run_sorting() { | ||
let temp_dir = tempfile::tempdir().unwrap(); | ||
let temp_path = temp_dir.path().to_path_buf(); | ||
let mut file = File::create(temp_path.join("testfile.txt")).unwrap(); | ||
writeln!(file, "Test content").unwrap(); | ||
|
||
let result = run_sorting(); | ||
assert!(result.is_ok()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub mod tests; | ||
pub mod custom_tests; |
Empty file.