openssl/ssl/context: test that we are refcounting correctly

Not a perfect test, on failure it _might_ exit with this output:

Process didn't exit successfully:
`/home/cody/g/rust-openssl/openssl/target/debug/openssl-8e712036e3aac4fe`
(signal: 11)

But unclear if we can do any better.
This commit is contained in:
Cody P Schafer 2016-01-18 16:39:27 -05:00
parent dacde211c3
commit d1825c7a86
1 changed files with 13 additions and 0 deletions

View File

@ -1045,3 +1045,16 @@ fn flush_panic() {
let mut stream = SslStream::connect(&ctx, stream).unwrap(); let mut stream = SslStream::connect(&ctx, stream).unwrap();
let _ = stream.flush(); let _ = stream.flush();
} }
#[test]
fn refcount_ssl_context() {
let ssl = {
let ctx = SslContext::new(SslMethod::Sslv23).unwrap();
ssl::Ssl::new(&ctx).unwrap()
};
{
let new_ctx_a = SslContext::new(SslMethod::Sslv23).unwrap();
let _new_ctx_b = ssl.set_ssl_context(&new_ctx_a);
}
}