]>
git.proxmox.com Git - libgit2.git/blob - tests/stream/deprecated.c
2c2bbfdc354bc00f21541301112234818748233c
1 #undef GIT_DEPRECATE_HARD
3 #include "clar_libgit2.h"
4 #include "git2/sys/stream.h"
5 #include "streams/tls.h"
6 #include "streams/socket.h"
9 static git_stream test_stream
;
10 static int ctor_called
;
12 void test_stream_deprecated__cleanup(void)
14 cl_git_pass(git_stream_register(GIT_STREAM_TLS
| GIT_STREAM_STANDARD
, NULL
));
17 static int test_stream_init(git_stream
**out
, const char *host
, const char *port
)
28 void test_stream_deprecated__register_tls(void)
34 cl_git_pass(git_stream_register_tls(test_stream_init
));
35 cl_git_pass(git_tls_stream_new(&stream
, "localhost", "443"));
36 cl_assert_equal_i(1, ctor_called
);
37 cl_assert_equal_p(&test_stream
, stream
);
41 cl_git_pass(git_stream_register_tls(NULL
));
42 error
= git_tls_stream_new(&stream
, "localhost", "443");
45 * We don't have TLS support enabled, or we're on Windows,
46 * which has no arbitrary TLS stream support.
48 #if defined(GIT_WIN32) || !defined(GIT_HTTPS)
49 cl_git_fail_with(-1, error
);
54 cl_assert_equal_i(0, ctor_called
);
55 cl_assert(&test_stream
!= stream
);
57 git_stream_free(stream
);