Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

Commit

Permalink
test: Add a broken test that's commented out (see #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatlittlegit committed Apr 22, 2018
1 parent 1daa444 commit ec711ed
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ url = "1.7.0"
log = "0.4.1"
env_logger = "0.5.6"
ammonia = "1.1.0"

# see issue #7
#[dev-dependencies]
#iron = "0.6.0"
47 changes: 47 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ extern crate reqwest;
extern crate robotparser;
extern crate url;

// see issue #7
//#[cfg(test)]
//extern crate iron;

use reqwest::Client;
use robotparser::RobotFileParser;
use url::Url;
Expand Down Expand Up @@ -74,6 +78,7 @@ fn main_loop() {
}

fn _main_loop(starton: String, panic: bool) -> Vec<String> {
// see issue #7
let client = Client::new();
let mut future_urls: Vec<String>;
let mut future_url_buffer: Vec<String> = Vec::new();
Expand Down Expand Up @@ -198,3 +203,45 @@ fn _main_loop(starton: String, panic: bool) -> Vec<String> {
}
}
}

#[cfg(test)]
mod tests {
// see issue #7
//use iron::{Iron, IronResult, Headers};
//use iron::response::Response;
//use iron::request::Request;
//use iron::status;
//use iron::middleware::Chain;
//use iron::headers::ContentType;
//use iron::mime::{Mime, TopLevel, SubLevel};
//use iron::typemap::TypeMap;
use std;

use ::*;

// see issue #7
//#[test]
//fn __main_loop() {
// fn handler(req: &mut Request) -> IronResult<Response> {
// let mut mime = Headers::new();
// mime.set(ContentType(Mime(TopLevel::Text, SubLevel::Html, Vec::new())));

// Ok(Response {
// headers: mime,
// status: Some(status::Ok),
// body: Some(Box::new(match req.url.path().join("/").as_str() {
// "" => "<a href='file'></a><a href='file1'></a>",
// "file" => "<a href='/file1'></a>",
// "file1" => "<a href='/file'></a>",
// _ => "not found"
// })),
// extensions: TypeMap::new()
// })
// }

// let child = std::thread::spawn(|| Iron::new(Chain::new(handler)).http("localhost:9999").unwrap());

// let f: Vec<String> = Vec::new();
// assert_eq!(_main_loop("http://localhost:9999/".to_string(), false), f);
//}
}

0 comments on commit ec711ed

Please sign in to comment.