aboutsummaryrefslogtreecommitdiff
path: root/src/ssl
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-10-07 11:05:53 -0700
committerSteven Fackler <[email protected]>2014-10-07 11:05:53 -0700
commitde3f1cf57f39582e9391663ccb6a2b0fcd13137c (patch)
tree1cb0974cc5cd3fb0e3583de03632b791b23a823c /src/ssl
parentMerge pull request #71 from vhbit/path-ization (diff)
parentFixed incorrect EOF handling in MemBio, added error description (diff)
downloadrust-openssl-de3f1cf57f39582e9391663ccb6a2b0fcd13137c.tar.xz
rust-openssl-de3f1cf57f39582e9391663ccb6a2b0fcd13137c.zip
Merge pull request #67 from vhbit/membio-eof
Fixed incorrect EOF handling in MemBio, added error description
Diffstat (limited to 'src/ssl')
-rw-r--r--src/ssl/tests.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ssl/tests.rs b/src/ssl/tests.rs
index 6cc40033..f98352be 100644
--- a/src/ssl/tests.rs
+++ b/src/ssl/tests.rs
@@ -1,4 +1,4 @@
-use std::io::Writer;
+use std::io::{File, Open, Write, Writer};
use std::io::net::tcp::TcpStream;
use std::num::FromStrRadix;
use std::str;
@@ -218,6 +218,22 @@ fn test_cert_gen() {
let res = gen.generate();
assert!(res.is_ok());
+
+ let (cert, pkey) = res.unwrap();
+
+ #[cfg(unix)]
+ static NULL_PATH: &'static str = "/dev/null";
+ #[cfg(windows)]
+ static NULL_PATH: &'static str = "nul";
+
+ let cert_path = Path::new(NULL_PATH);
+ let mut file = File::open_mode(&cert_path, Open, Write).unwrap();
+ assert!(cert.write_pem(&mut file).is_ok());
+
+ let key_path = Path::new(NULL_PATH);
+ let mut file = File::open_mode(&key_path, Open, Write).unwrap();
+ assert!(pkey.write_pem(&mut file).is_ok());
+
// FIXME: check data in result to be correct, needs implementation
// of X509 getters
}