Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
3680f0bf
Commit
3680f0bf
authored
Aug 31, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: create the network::url test hierarcy
parent
1196de4f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
tests/network/url/joinpath.c
+8
-8
tests/network/url/parse.c
+0
-0
tests/network/url/redirect.c
+12
-12
No files found.
tests/network/joinpath.c
→
tests/network/
url/
joinpath.c
View file @
3680f0bf
...
@@ -4,19 +4,19 @@
...
@@ -4,19 +4,19 @@
static
git_net_url
source
,
target
;
static
git_net_url
source
,
target
;
void
test_network_joinpath__initialize
(
void
)
void
test_network_
url_
joinpath__initialize
(
void
)
{
{
memset
(
&
source
,
0
,
sizeof
(
source
));
memset
(
&
source
,
0
,
sizeof
(
source
));
memset
(
&
target
,
0
,
sizeof
(
target
));
memset
(
&
target
,
0
,
sizeof
(
target
));
}
}
void
test_network_joinpath__cleanup
(
void
)
void
test_network_
url_
joinpath__cleanup
(
void
)
{
{
git_net_url_dispose
(
&
source
);
git_net_url_dispose
(
&
source
);
git_net_url_dispose
(
&
target
);
git_net_url_dispose
(
&
target
);
}
}
void
test_network_joinpath__target_paths_and_queries
(
void
)
void
test_network_
url_
joinpath__target_paths_and_queries
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b"
));
...
@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void)
...
@@ -31,7 +31,7 @@ void test_network_joinpath__target_paths_and_queries(void)
git_net_url_dispose
(
&
target
);
git_net_url_dispose
(
&
target
);
}
}
void
test_network_joinpath__source_query_removed
(
void
)
void
test_network_
url_
joinpath__source_query_removed
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b?query&one&two"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b?query&one&two"
));
...
@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void)
...
@@ -46,7 +46,7 @@ void test_network_joinpath__source_query_removed(void)
git_net_url_dispose
(
&
target
);
git_net_url_dispose
(
&
target
);
}
}
void
test_network_joinpath__source_lacks_path
(
void
)
void
test_network_
url_
joinpath__source_lacks_path
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com"
));
...
@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void)
...
@@ -91,7 +91,7 @@ void test_network_joinpath__source_lacks_path(void)
git_net_url_dispose
(
&
target
);
git_net_url_dispose
(
&
target
);
}
}
void
test_network_joinpath__source_is_slash
(
void
)
void
test_network_
url_
joinpath__source_is_slash
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/"
));
...
@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void)
...
@@ -137,7 +137,7 @@ void test_network_joinpath__source_is_slash(void)
}
}
void
test_network_joinpath__source_has_query
(
void
)
void
test_network_
url_
joinpath__source_has_query
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com?query"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com?query"
));
...
@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void)
...
@@ -183,7 +183,7 @@ void test_network_joinpath__source_has_query(void)
}
}
void
test_network_joinpath__empty_query_ignored
(
void
)
void
test_network_
url_
joinpath__empty_query_ignored
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/foo"
));
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/foo"
));
...
...
tests/network/urlparse.c
→
tests/network/url
/
parse.c
View file @
3680f0bf
This diff is collapsed.
Click to expand it.
tests/network/redirect.c
→
tests/network/
url/
redirect.c
View file @
3680f0bf
...
@@ -4,17 +4,17 @@
...
@@ -4,17 +4,17 @@
static
git_net_url
conndata
;
static
git_net_url
conndata
;
void
test_network_redirect__initialize
(
void
)
void
test_network_
url_
redirect__initialize
(
void
)
{
{
memset
(
&
conndata
,
0
,
sizeof
(
conndata
));
memset
(
&
conndata
,
0
,
sizeof
(
conndata
));
}
}
void
test_network_redirect__cleanup
(
void
)
void
test_network_
url_
redirect__cleanup
(
void
)
{
{
git_net_url_dispose
(
&
conndata
);
git_net_url_dispose
(
&
conndata
);
}
}
void
test_network_redirect__redirect_http
(
void
)
void
test_network_
url_
redirect__redirect_http
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com/foo/bar/baz"
));
"http://example.com/foo/bar/baz"
));
...
@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void)
...
@@ -28,7 +28,7 @@ void test_network_redirect__redirect_http(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
}
void
test_network_redirect__redirect_ssl
(
void
)
void
test_network_
url_
redirect__redirect_ssl
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://example.com/foo/bar/baz"
));
"https://example.com/foo/bar/baz"
));
...
@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void)
...
@@ -42,7 +42,7 @@ void test_network_redirect__redirect_ssl(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
}
void
test_network_redirect__redirect_leaves_root_path
(
void
)
void
test_network_
url_
redirect__redirect_leaves_root_path
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://example.com/foo/bar/baz"
));
"https://example.com/foo/bar/baz"
));
...
@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void)
...
@@ -56,7 +56,7 @@ void test_network_redirect__redirect_leaves_root_path(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
}
void
test_network_redirect__redirect_encoded_username_password
(
void
)
void
test_network_
url_
redirect__redirect_encoded_username_password
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"
));
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"
));
...
@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void)
...
@@ -70,7 +70,7 @@ void test_network_redirect__redirect_encoded_username_password(void)
cl_assert_equal_s
(
conndata
.
password
,
"pass@word%zyx%v"
);
cl_assert_equal_s
(
conndata
.
password
,
"pass@word%zyx%v"
);
}
}
void
test_network_redirect__redirect_cross_host_denied
(
void
)
void
test_network_
url_
redirect__redirect_cross_host_denied
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://bar.com/bar/baz"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://bar.com/bar/baz"
));
cl_git_fail_with
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_fail_with
(
git_net_url_apply_redirect
(
&
conndata
,
...
@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void)
...
@@ -78,7 +78,7 @@ void test_network_redirect__redirect_cross_host_denied(void)
-
1
);
-
1
);
}
}
void
test_network_redirect__redirect_http_downgrade_denied
(
void
)
void
test_network_
url_
redirect__redirect_http_downgrade_denied
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz"
));
cl_git_fail_with
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_fail_with
(
git_net_url_apply_redirect
(
&
conndata
,
...
@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void)
...
@@ -86,7 +86,7 @@ void test_network_redirect__redirect_http_downgrade_denied(void)
-
1
);
-
1
);
}
}
void
test_network_redirect__redirect_relative
(
void
)
void
test_network_
url_
redirect__redirect_relative
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://foo.com/bar/baz/biff"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://foo.com/bar/baz/biff"
));
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
...
@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void)
...
@@ -99,7 +99,7 @@ void test_network_redirect__redirect_relative(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
}
void
test_network_redirect__redirect_relative_ssl
(
void
)
void
test_network_
url_
redirect__redirect_relative_ssl
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz/biff"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz/biff"
));
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
...
@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void)
...
@@ -112,7 +112,7 @@ void test_network_redirect__redirect_relative_ssl(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
}
void
test_network_redirect__service_query_no_query_params_in_location
(
void
)
void
test_network_
url_
redirect__service_query_no_query_params_in_location
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/info/refs?service=git-upload-pack"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/info/refs?service=git-upload-pack"
));
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
...
@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void)
...
@@ -120,7 +120,7 @@ void test_network_redirect__service_query_no_query_params_in_location(void)
cl_assert_equal_s
(
conndata
.
path
,
"/baz"
);
cl_assert_equal_s
(
conndata
.
path
,
"/baz"
);
}
}
void
test_network_redirect__service_query_with_query_params_in_location
(
void
)
void
test_network_
url_
redirect__service_query_with_query_params_in_location
(
void
)
{
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/info/refs?service=git-upload-pack"
));
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/info/refs?service=git-upload-pack"
));
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
cl_git_pass
(
git_net_url_apply_redirect
(
&
conndata
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment