77static git_stream test_stream ;
88static int ctor_called ;
99
10+ void test_core_stream__cleanup (void )
11+ {
12+ cl_git_pass (git_stream_register (GIT_STREAM_TLS | GIT_STREAM_STANDARD , NULL ));
13+ }
14+
1015static int test_stream_init (git_stream * * out , const char * host , const char * port )
1116{
1217 GIT_UNUSED (host );
@@ -39,14 +44,14 @@ void test_core_stream__register_insecure(void)
3944 registration .wrap = test_stream_wrap ;
4045
4146 ctor_called = 0 ;
42- cl_git_pass (git_stream_register (0 , & registration ));
47+ cl_git_pass (git_stream_register (GIT_STREAM_STANDARD , & registration ));
4348 cl_git_pass (git_socket_stream_new (& stream , "localhost" , "80" ));
4449 cl_assert_equal_i (1 , ctor_called );
4550 cl_assert_equal_p (& test_stream , stream );
4651
4752 ctor_called = 0 ;
4853 stream = NULL ;
49- cl_git_pass (git_stream_register (0 , NULL ));
54+ cl_git_pass (git_stream_register (GIT_STREAM_STANDARD , NULL ));
5055 cl_git_pass (git_socket_stream_new (& stream , "localhost" , "80" ));
5156
5257 cl_assert_equal_i (0 , ctor_called );
@@ -66,14 +71,14 @@ void test_core_stream__register_tls(void)
6671 registration .wrap = test_stream_wrap ;
6772
6873 ctor_called = 0 ;
69- cl_git_pass (git_stream_register (1 , & registration ));
74+ cl_git_pass (git_stream_register (GIT_STREAM_TLS , & registration ));
7075 cl_git_pass (git_tls_stream_new (& stream , "localhost" , "443" ));
7176 cl_assert_equal_i (1 , ctor_called );
7277 cl_assert_equal_p (& test_stream , stream );
7378
7479 ctor_called = 0 ;
7580 stream = NULL ;
76- cl_git_pass (git_stream_register (1 , NULL ));
81+ cl_git_pass (git_stream_register (GIT_STREAM_TLS , NULL ));
7782 error = git_tls_stream_new (& stream , "localhost" , "443" );
7883
7984 /* We don't have TLS support enabled, or we're on Windows,
@@ -91,6 +96,28 @@ void test_core_stream__register_tls(void)
9196 git_stream_free (stream );
9297}
9398
99+ void test_core_stream__register_both (void )
100+ {
101+ git_stream * stream ;
102+ git_stream_registration registration = {0 };
103+
104+ registration .version = 1 ;
105+ registration .init = test_stream_init ;
106+ registration .wrap = test_stream_wrap ;
107+
108+ cl_git_pass (git_stream_register (GIT_STREAM_STANDARD | GIT_STREAM_TLS , & registration ));
109+
110+ ctor_called = 0 ;
111+ cl_git_pass (git_tls_stream_new (& stream , "localhost" , "443" ));
112+ cl_assert_equal_i (1 , ctor_called );
113+ cl_assert_equal_p (& test_stream , stream );
114+
115+ ctor_called = 0 ;
116+ cl_git_pass (git_socket_stream_new (& stream , "localhost" , "80" ));
117+ cl_assert_equal_i (1 , ctor_called );
118+ cl_assert_equal_p (& test_stream , stream );
119+ }
120+
94121void test_core_stream__register_tls_deprecated (void )
95122{
96123 git_stream * stream ;
0 commit comments