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