Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
884b2d1
[Added] mowl for logging
se-spiess Jan 26, 2017
5df7e2e
Merge branch 'master' of https://github.com/Drogglbecher/wiki
se-spiess Feb 2, 2017
a04851d
[Improved] error handling
se-spiess Feb 4, 2017
4e26ad1
[Improved] error handling
se-spiess Feb 4, 2017
f537493
[Improved] error handling
se-spiess Feb 4, 2017
f9f7682
[Added] mowl for logging
se-spiess Jan 26, 2017
161c2a2
[Improved] unittesting for test coverage
se-spiess Feb 13, 2017
fb83a78
Merge branch 'master' of https://github.com/Drogglbecher/wiki
se-spiess Feb 13, 2017
d6448d3
[Changed] processing as lib, moved test files to `tests` folder
Drogglbecher Feb 13, 2017
d7e54c7
[Changed] test examples to `tests` folder and renamed lib to `wikilib`
Drogglbecher Feb 13, 2017
b55a70a
Merge branch 'master' of https://github.com/rust-leipzig/wiki
se-spiess Feb 16, 2017
e055547
Merge remote-tracking branch 'upstream/master'
se-spiess Mar 6, 2017
9680954
[Added] HTML file creation in output directory
se-spiess Mar 6, 2017
48c1bb5
[Removed] test for process.rs
se-spiess Mar 6, 2017
96eddf4
[Fixed] Unittest for generated HTML files
se-spiess Mar 7, 2017
ecbd1b5
Merge branch 'master' into master
saschagrunert Mar 9, 2017
f832504
Update lib.rs
saschagrunert Mar 9, 2017
d787ac2
Update lib.rs
saschagrunert Mar 9, 2017
57fba32
Update main.rs
saschagrunert Mar 9, 2017
5b77c45
Merge remote-tracking branch 'upstream/master'
se-spiess Mar 9, 2017
fbc8fcc
Merge remote-tracking branch 'origin/master'
se-spiess Mar 9, 2017
f8f22c9
[Changed] preserve markdown substructure for HTML output
se-spiess Mar 9, 2017
8814946
[Improved] replaced to_str-unwraps with error codes
se-spiess Mar 11, 2017
aa3d1eb
Merge remote-tracking branch 'upstream/master'
se-spiess Mar 16, 2017
4be9d36
[Added] test for errors
se-spiess Mar 16, 2017
f3cac29
[Changed] error handling to error_chain crate
Drogglbecher Mar 19, 2017
cb802f6
[Changed] test files for error_chain integration
Drogglbecher Mar 19, 2017
f699da5
Merge remote-tracking branch 'upstream/master'
Drogglbecher Mar 19, 2017
42b9908
[Removed] error_chain macro
Drogglbecher Mar 19, 2017
bbb0b35
Merge remote-tracking branch 'upstream/master'
Drogglbecher Apr 24, 2017
4714f9c
[Improved] test coverage
Drogglbecher May 3, 2017
fa1eb11
[Removed] 'static for rust 1.17 behaviour
Drogglbecher May 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extern crate wikilib;

use wikilib::error::*;
use std::error::Error as StdError;
use std::io;

static ERROR_STR: &str = "Something went wrong here.";

#[test]
fn io_error_to_wiki_error() {
let io_error = io::Error::new(io::ErrorKind::NotFound, ERROR_STR);
let wiki_error: Error = io_error.into();
assert_eq!(wiki_error.description(), ERROR_STR.to_string());
}

29 changes: 24 additions & 5 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ use log::LogLevel;
use wikilib::Wiki;

use std::path::Path;
use std::fs;

static NON_EXISTING_DIR: &str = "_should_not_exist_";
static TMP_DIR: &str = "_tmp_dir_";

#[test]
fn test_read_from_directory() {
Expand All @@ -26,15 +30,30 @@ fn test_read_from_directory() {
for path in check_paths {
assert!(Path::new(path).exists());
}
println!("The following paths were found:");
wiki.list_current_paths();
}

#[test]
#[should_panic]
fn test_read_from_directory_panic() {
fn test_read_from_non_existing_directory() {
let mut wiki = Wiki::new();
match wiki.read_from_directory("_non-exisiting_") {
Ok(_) => return,
Err(_) => panic!("`read_from_directory` returned ok, but directory should not exist."),
if wiki.read_from_directory("_non-exisiting_").is_ok() {
panic!("`read_from_directory` returned ok, but directory should not exist.");
}
}

#[test]
fn test_read_non_existing_content() {
let mut wiki = Wiki::new();
if Path::new(TMP_DIR).exists() {
assert!(fs::remove_dir_all(TMP_DIR).is_ok());
}
assert!(fs::create_dir(TMP_DIR).is_ok());
assert!(fs::File::create(Path::new(TMP_DIR).join("test.md")).is_ok());
assert!(wiki.read_from_directory(TMP_DIR).is_ok());
assert!(fs::remove_dir_all(TMP_DIR).is_ok());
match wiki.read_content_from_current_paths(TMP_DIR, NON_EXISTING_DIR) {
Ok(_) => panic!("`read_content_from_current_paths` returned ok, but should fail."),
Err(_) => assert!(fs::remove_dir_all(NON_EXISTING_DIR).is_ok())
}
}