From 24c6561bc169d3dd4a57216031b3c72a1cc8f993 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 29 Jul 2016 10:48:05 +0200 Subject: [PATCH] Add test. --- parity/configuration.rs | 14 ++++++++++++++ parity/main.rs | 2 ++ 2 files changed, 16 insertions(+) diff --git a/parity/configuration.rs b/parity/configuration.rs index f14442097..9e779ef91 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -538,6 +538,9 @@ mod tests { use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain}; use presale::ImportWallet; use account::{AccountCmd, NewAccount, ImportAccounts}; + use devtools::{RandomTempPath}; + use std::io::Write; + use std::fs::{File, create_dir}; #[derive(Debug, PartialEq)] struct TestPasswordReader(&'static str); @@ -769,5 +772,16 @@ mod tests { // then assert_eq!(conf0.signer_enabled(), false); } + + #[test] + fn should_not_bail_on_empty_line_in_reserved_peers() { + let temp = RandomTempPath::new(); + create_dir(temp.as_str().to_owned()).unwrap(); + let filename = temp.as_str().to_owned() + "/peers"; + File::create(filename.clone()).unwrap().write_all(b" \n\t\n").unwrap(); + let args = vec!["parity", "--reserved-peers", &filename]; + let conf = Configuration::parse(args).unwrap(); + assert!(conf.init_reserved_nodes().is_ok()); + } } diff --git a/parity/main.rs b/parity/main.rs index 4c1aae65e..ca578c787 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -25,6 +25,8 @@ extern crate docopt; extern crate num_cpus; extern crate rustc_serialize; +extern crate ethcore_devtools as devtools; +#[macro_use] extern crate ethcore_util as util; extern crate ethcore; extern crate ethsync;