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
96d2d429
Commit
96d2d429
authored
Apr 14, 2022
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: move url tests into util
parent
f98dd543
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
86 deletions
+86
-86
tests/util/url/joinpath.c
+8
-8
tests/util/url/parse.c
+39
-39
tests/util/url/pattern.c
+2
-2
tests/util/url/redirect.c
+13
-13
tests/util/url/scp.c
+23
-23
tests/util/url/valid.c
+1
-1
No files found.
tests/
libgit2/network
/url/joinpath.c
→
tests/
util
/url/joinpath.c
View file @
96d2d429
...
...
@@ -4,19 +4,19 @@
static
git_net_url
source
,
target
;
void
test_
network_
url_joinpath__initialize
(
void
)
void
test_url_joinpath__initialize
(
void
)
{
memset
(
&
source
,
0
,
sizeof
(
source
));
memset
(
&
target
,
0
,
sizeof
(
target
));
}
void
test_
network_
url_joinpath__cleanup
(
void
)
void
test_url_joinpath__cleanup
(
void
)
{
git_net_url_dispose
(
&
source
);
git_net_url_dispose
(
&
target
);
}
void
test_
network_
url_joinpath__target_paths_and_queries
(
void
)
void
test_url_joinpath__target_paths_and_queries
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b"
));
...
...
@@ -31,7 +31,7 @@ void test_network_url_joinpath__target_paths_and_queries(void)
git_net_url_dispose
(
&
target
);
}
void
test_
network_
url_joinpath__source_query_removed
(
void
)
void
test_url_joinpath__source_query_removed
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/a/b?query&one&two"
));
...
...
@@ -46,7 +46,7 @@ void test_network_url_joinpath__source_query_removed(void)
git_net_url_dispose
(
&
target
);
}
void
test_
network_
url_joinpath__source_lacks_path
(
void
)
void
test_url_joinpath__source_lacks_path
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com"
));
...
...
@@ -91,7 +91,7 @@ void test_network_url_joinpath__source_lacks_path(void)
git_net_url_dispose
(
&
target
);
}
void
test_
network_
url_joinpath__source_is_slash
(
void
)
void
test_url_joinpath__source_is_slash
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/"
));
...
...
@@ -137,7 +137,7 @@ void test_network_url_joinpath__source_is_slash(void)
}
void
test_
network_
url_joinpath__source_has_query
(
void
)
void
test_url_joinpath__source_has_query
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com?query"
));
...
...
@@ -183,7 +183,7 @@ void test_network_url_joinpath__source_has_query(void)
}
void
test_
network_
url_joinpath__empty_query_ignored
(
void
)
void
test_url_joinpath__empty_query_ignored
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
source
,
"http://example.com/foo"
));
...
...
tests/
libgit2/network
/url/parse.c
→
tests/
util
/url/parse.c
View file @
96d2d429
...
...
@@ -3,19 +3,19 @@
static
git_net_url
conndata
;
void
test_
network_
url_parse__initialize
(
void
)
void
test_url_parse__initialize
(
void
)
{
memset
(
&
conndata
,
0
,
sizeof
(
conndata
));
}
void
test_
network_
url_parse__cleanup
(
void
)
void
test_url_parse__cleanup
(
void
)
{
git_net_url_dispose
(
&
conndata
);
}
/* Hostname */
void
test_
network_
url_parse__hostname_trivial
(
void
)
void
test_url_parse__hostname_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -27,7 +27,7 @@ void test_network_url_parse__hostname_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_root
(
void
)
void
test_url_parse__hostname_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com/"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -39,7 +39,7 @@ void test_network_url_parse__hostname_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_implied_root
(
void
)
void
test_url_parse__hostname_implied_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -51,7 +51,7 @@ void test_network_url_parse__hostname_implied_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_implied_root_custom_port
(
void
)
void
test_url_parse__hostname_implied_root_custom_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com:42"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -63,7 +63,7 @@ void test_network_url_parse__hostname_implied_root_custom_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__hostname_implied_root_empty_port
(
void
)
void
test_url_parse__hostname_implied_root_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com:"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -75,7 +75,7 @@ void test_network_url_parse__hostname_implied_root_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_encoded_password
(
void
)
void
test_url_parse__hostname_encoded_password
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass%2fis%40bad@hostname.com:1234/"
));
...
...
@@ -88,7 +88,7 @@ void test_network_url_parse__hostname_encoded_password(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__hostname_user
(
void
)
void
test_url_parse__hostname_user
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user@example.com/resource"
));
...
...
@@ -101,7 +101,7 @@ void test_network_url_parse__hostname_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_user_pass
(
void
)
void
test_url_parse__hostname_user_pass
(
void
)
{
/* user:pass@hostname.tld/resource */
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
...
...
@@ -115,7 +115,7 @@ void test_network_url_parse__hostname_user_pass(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_port
(
void
)
void
test_url_parse__hostname_port
(
void
)
{
/* hostname.tld:port/resource */
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
...
...
@@ -129,7 +129,7 @@ void test_network_url_parse__hostname_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__hostname_empty_port
(
void
)
void
test_url_parse__hostname_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -141,7 +141,7 @@ void test_network_url_parse__hostname_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__hostname_user_port
(
void
)
void
test_url_parse__hostname_user_port
(
void
)
{
/* user@hostname.tld:port/resource */
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
...
...
@@ -155,7 +155,7 @@ void test_network_url_parse__hostname_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__hostname_user_pass_port
(
void
)
void
test_url_parse__hostname_user_pass_port
(
void
)
{
/* user:pass@hostname.tld:port/resource */
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
...
...
@@ -171,7 +171,7 @@ void test_network_url_parse__hostname_user_pass_port(void)
/* IPv4 addresses */
void
test_
network_
url_parse__ipv4_trivial
(
void
)
void
test_url_parse__ipv4_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -183,7 +183,7 @@ void test_network_url_parse__ipv4_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_root
(
void
)
void
test_url_parse__ipv4_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1/"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -195,7 +195,7 @@ void test_network_url_parse__ipv4_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_implied_root
(
void
)
void
test_url_parse__ipv4_implied_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -207,7 +207,7 @@ void test_network_url_parse__ipv4_implied_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_implied_root_custom_port
(
void
)
void
test_url_parse__ipv4_implied_root_custom_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1:42"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -219,7 +219,7 @@ void test_network_url_parse__ipv4_implied_root_custom_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv4_implied_root_empty_port
(
void
)
void
test_url_parse__ipv4_implied_root_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1:"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -231,7 +231,7 @@ void test_network_url_parse__ipv4_implied_root_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_encoded_password
(
void
)
void
test_url_parse__ipv4_encoded_password
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass%2fis%40bad@192.168.1.1:1234/"
));
...
...
@@ -244,7 +244,7 @@ void test_network_url_parse__ipv4_encoded_password(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv4_user
(
void
)
void
test_url_parse__ipv4_user
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user@192.168.1.1/resource"
));
...
...
@@ -257,7 +257,7 @@ void test_network_url_parse__ipv4_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_user_pass
(
void
)
void
test_url_parse__ipv4_user_pass
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass@192.168.1.1/resource"
));
...
...
@@ -270,7 +270,7 @@ void test_network_url_parse__ipv4_user_pass(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_port
(
void
)
void
test_url_parse__ipv4_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://192.168.1.1:9191/resource"
));
...
...
@@ -283,7 +283,7 @@ void test_network_url_parse__ipv4_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv4_empty_port
(
void
)
void
test_url_parse__ipv4_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://192.168.1.1:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -295,7 +295,7 @@ void test_network_url_parse__ipv4_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv4_user_port
(
void
)
void
test_url_parse__ipv4_user_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user@192.168.1.1:9191/resource"
));
...
...
@@ -308,7 +308,7 @@ void test_network_url_parse__ipv4_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv4_user_pass_port
(
void
)
void
test_url_parse__ipv4_user_pass_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass@192.168.1.1:9191/resource"
));
...
...
@@ -323,7 +323,7 @@ void test_network_url_parse__ipv4_user_pass_port(void)
/* IPv6 addresses */
void
test_
network_
url_parse__ipv6_trivial
(
void
)
void
test_url_parse__ipv6_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -335,7 +335,7 @@ void test_network_url_parse__ipv6_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_root
(
void
)
void
test_url_parse__ipv6_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]/"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -347,7 +347,7 @@ void test_network_url_parse__ipv6_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_implied_root
(
void
)
void
test_url_parse__ipv6_implied_root
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -359,7 +359,7 @@ void test_network_url_parse__ipv6_implied_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_implied_root_custom_port
(
void
)
void
test_url_parse__ipv6_implied_root_custom_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]:42"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -371,7 +371,7 @@ void test_network_url_parse__ipv6_implied_root_custom_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv6_implied_root_empty_port
(
void
)
void
test_url_parse__ipv6_implied_root_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]:"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -383,7 +383,7 @@ void test_network_url_parse__ipv6_implied_root_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_encoded_password
(
void
)
void
test_url_parse__ipv6_encoded_password
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass%2fis%40bad@[fe80::dcad:beff:fe00:0001]:1234/"
));
...
...
@@ -396,7 +396,7 @@ void test_network_url_parse__ipv6_encoded_password(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv6_user
(
void
)
void
test_url_parse__ipv6_user
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user@[fe80::dcad:beff:fe00:0001]/resource"
));
...
...
@@ -409,7 +409,7 @@ void test_network_url_parse__ipv6_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_user_pass
(
void
)
void
test_url_parse__ipv6_user_pass
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass@[fe80::dcad:beff:fe00:0001]/resource"
));
...
...
@@ -422,7 +422,7 @@ void test_network_url_parse__ipv6_user_pass(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_port
(
void
)
void
test_url_parse__ipv6_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://[fe80::dcad:beff:fe00:0001]:9191/resource"
));
...
...
@@ -435,7 +435,7 @@ void test_network_url_parse__ipv6_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv6_empty_port
(
void
)
void
test_url_parse__ipv6_empty_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://[fe80::dcad:beff:fe00:0001]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"http"
);
...
...
@@ -447,7 +447,7 @@ void test_network_url_parse__ipv6_empty_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_parse__ipv6_user_port
(
void
)
void
test_url_parse__ipv6_user_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user@[fe80::dcad:beff:fe00:0001]:9191/resource"
));
...
...
@@ -460,7 +460,7 @@ void test_network_url_parse__ipv6_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv6_user_pass_port
(
void
)
void
test_url_parse__ipv6_user_pass_port
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user:pass@[fe80::dcad:beff:fe00:0001]:9191/resource"
));
...
...
@@ -473,7 +473,7 @@ void test_network_url_parse__ipv6_user_pass_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_parse__ipv6_invalid_addresses
(
void
)
void
test_url_parse__ipv6_invalid_addresses
(
void
)
{
/* Opening bracket missing */
cl_git_fail_with
(
GIT_EINVALIDSPEC
,
git_net_url_parse
(
&
conndata
,
...
...
tests/
libgit2/network
/url/pattern.c
→
tests/
util
/url/pattern.c
View file @
96d2d429
...
...
@@ -7,7 +7,7 @@ struct url_pattern {
bool
matches
;
};
void
test_
network_
url_pattern__single
(
void
)
void
test_url_pattern__single
(
void
)
{
git_net_url
url
;
size_t
i
;
...
...
@@ -53,7 +53,7 @@ void test_network_url_pattern__single(void)
}
}
void
test_
network_
url_pattern__list
(
void
)
void
test_url_pattern__list
(
void
)
{
git_net_url
url
;
size_t
i
;
...
...
tests/
libgit2/network
/url/redirect.c
→
tests/
util
/url/redirect.c
View file @
96d2d429
...
...
@@ -4,17 +4,17 @@
static
git_net_url
conndata
;
void
test_
network_
url_redirect__initialize
(
void
)
void
test_url_redirect__initialize
(
void
)
{
memset
(
&
conndata
,
0
,
sizeof
(
conndata
));
}
void
test_
network_
url_redirect__cleanup
(
void
)
void
test_url_redirect__cleanup
(
void
)
{
git_net_url_dispose
(
&
conndata
);
}
void
test_
network_
url_redirect__redirect_http
(
void
)
void
test_url_redirect__redirect_http
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://example.com/foo/bar/baz"
));
...
...
@@ -28,7 +28,7 @@ void test_network_url_redirect__redirect_http(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__redirect_ssl
(
void
)
void
test_url_redirect__redirect_ssl
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://example.com/foo/bar/baz"
));
...
...
@@ -42,7 +42,7 @@ void test_network_url_redirect__redirect_ssl(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__redirect_leaves_root_path
(
void
)
void
test_url_redirect__redirect_leaves_root_path
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://example.com/foo/bar/baz"
));
...
...
@@ -56,7 +56,7 @@ void test_network_url_redirect__redirect_leaves_root_path(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__redirect_encoded_username_password
(
void
)
void
test_url_redirect__redirect_encoded_username_password
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://user%2fname:pass%40word%zyx%v@example.com/foo/bar/baz"
));
...
...
@@ -70,7 +70,7 @@ void test_network_url_redirect__redirect_encoded_username_password(void)
cl_assert_equal_s
(
conndata
.
password
,
"pass@word%zyx%v"
);
}
void
test_
network_
url_redirect__redirect_cross_host_allowed
(
void
)
void
test_url_redirect__redirect_cross_host_allowed
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://bar.com/bar/baz"
));
...
...
@@ -84,7 +84,7 @@ void test_network_url_redirect__redirect_cross_host_allowed(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__redirect_cross_host_denied
(
void
)
void
test_url_redirect__redirect_cross_host_denied
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://bar.com/bar/baz"
));
...
...
@@ -92,7 +92,7 @@ void test_network_url_redirect__redirect_cross_host_denied(void)
"https://foo.com/bar/baz"
,
false
,
NULL
),
-
1
);
}
void
test_
network_
url_redirect__redirect_http_downgrade_denied
(
void
)
void
test_url_redirect__redirect_http_downgrade_denied
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz"
));
...
...
@@ -100,7 +100,7 @@ void test_network_url_redirect__redirect_http_downgrade_denied(void)
"http://foo.com/bar/baz"
,
true
,
NULL
),
-
1
);
}
void
test_
network_
url_redirect__redirect_relative
(
void
)
void
test_url_redirect__redirect_relative
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"http://foo.com/bar/baz/biff"
));
...
...
@@ -114,7 +114,7 @@ void test_network_url_redirect__redirect_relative(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__redirect_relative_ssl
(
void
)
void
test_url_redirect__redirect_relative_ssl
(
void
)
{
cl_git_pass
(
git_net_url_parse
(
&
conndata
,
"https://foo.com/bar/baz/biff"
));
...
...
@@ -128,7 +128,7 @@ void test_network_url_redirect__redirect_relative_ssl(void)
cl_assert_equal_p
(
conndata
.
password
,
NULL
);
}
void
test_
network_
url_redirect__service_query_no_query_params_in_location
(
void
)
void
test_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"
));
...
...
@@ -137,7 +137,7 @@ void test_network_url_redirect__service_query_no_query_params_in_location(void)
cl_assert_equal_s
(
conndata
.
path
,
"/baz"
);
}
void
test_
network_
url_redirect__service_query_with_query_params_in_location
(
void
)
void
test_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"
));
...
...
tests/
libgit2/network
/url/scp.c
→
tests/
util
/url/scp.c
View file @
96d2d429
...
...
@@ -3,19 +3,19 @@
static
git_net_url
conndata
;
void
test_
network_
url_scp__initialize
(
void
)
void
test_url_scp__initialize
(
void
)
{
memset
(
&
conndata
,
0
,
sizeof
(
conndata
));
}
void
test_
network_
url_scp__cleanup
(
void
)
void
test_url_scp__cleanup
(
void
)
{
git_net_url_dispose
(
&
conndata
);
}
/* Hostname */
void
test_
network_
url_scp__hostname_trivial
(
void
)
void
test_url_scp__hostname_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"example.com:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -27,7 +27,7 @@ void test_network_url_scp__hostname_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__hostname_bracketed
(
void
)
void
test_url_scp__hostname_bracketed
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[example.com]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -39,7 +39,7 @@ void test_network_url_scp__hostname_bracketed(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__hostname_root
(
void
)
void
test_url_scp__hostname_root
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"example.com:/"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -51,7 +51,7 @@ void test_network_url_scp__hostname_root(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__hostname_user
(
void
)
void
test_url_scp__hostname_user
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"git@example.com:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -63,7 +63,7 @@ void test_network_url_scp__hostname_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__hostname_user_bracketed
(
void
)
void
test_url_scp__hostname_user_bracketed
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[git@example.com]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -75,7 +75,7 @@ void test_network_url_scp__hostname_user_bracketed(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__hostname_port
(
void
)
void
test_url_scp__hostname_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[example.com:42]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -87,7 +87,7 @@ void test_network_url_scp__hostname_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__hostname_user_port
(
void
)
void
test_url_scp__hostname_user_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[git@example.com:42]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -99,7 +99,7 @@ void test_network_url_scp__hostname_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__ipv4_trivial
(
void
)
void
test_url_scp__ipv4_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"192.168.99.88:/resource/a/b/c"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -111,7 +111,7 @@ void test_network_url_scp__ipv4_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__ipv4_bracketed
(
void
)
void
test_url_scp__ipv4_bracketed
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[192.168.99.88]:/resource/a/b/c"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -123,7 +123,7 @@ void test_network_url_scp__ipv4_bracketed(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__ipv4_user
(
void
)
void
test_url_scp__ipv4_user
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"git@192.168.99.88:/resource/a/b/c"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -135,7 +135,7 @@ void test_network_url_scp__ipv4_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__ipv4_port
(
void
)
void
test_url_scp__ipv4_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[192.168.99.88:1111]:/resource/a/b/c"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -147,7 +147,7 @@ void test_network_url_scp__ipv4_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__ipv4_user_port
(
void
)
void
test_url_scp__ipv4_user_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[git@192.168.99.88:1111]:/resource/a/b/c"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -159,7 +159,7 @@ void test_network_url_scp__ipv4_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__ipv6_trivial
(
void
)
void
test_url_scp__ipv6_trivial
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[fe80::dcad:beff:fe00:0001]:/resource/foo"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -171,7 +171,7 @@ void test_network_url_scp__ipv6_trivial(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__ipv6_user
(
void
)
void
test_url_scp__ipv6_user
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"git@[fe80::dcad:beff:fe00:0001]:/resource/foo"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -183,7 +183,7 @@ void test_network_url_scp__ipv6_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__ipv6_port
(
void
)
void
test_url_scp__ipv6_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[[fe80::dcad:beff:fe00:0001]:99]:/resource/foo"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -195,7 +195,7 @@ void test_network_url_scp__ipv6_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__ipv6_user_port
(
void
)
void
test_url_scp__ipv6_user_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[git@[fe80::dcad:beff:fe00:0001]:99]:/resource/foo"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -207,7 +207,7 @@ void test_network_url_scp__ipv6_user_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
0
);
}
void
test_
network_
url_scp__hexhost_and_port
(
void
)
void
test_url_scp__hexhost_and_port
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[fe:22]:/resource/foo"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -219,7 +219,7 @@ void test_network_url_scp__hexhost_and_port(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__malformed_ipv6_one
(
void
)
void
test_url_scp__malformed_ipv6_one
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"fe80::dcad:beff:fe00:0001]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -231,7 +231,7 @@ void test_network_url_scp__malformed_ipv6_one(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__malformed_ipv6_two
(
void
)
void
test_url_scp__malformed_ipv6_two
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"[fe80::dcad:beff:fe00:0001]:42]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -243,7 +243,7 @@ void test_network_url_scp__malformed_ipv6_two(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__malformed_ipv6_with_user
(
void
)
void
test_url_scp__malformed_ipv6_with_user
(
void
)
{
cl_git_pass
(
git_net_url_parse_scp
(
&
conndata
,
"git@[fe80::dcad:beff:fe00:0001]:42]:/resource"
));
cl_assert_equal_s
(
conndata
.
scheme
,
"ssh"
);
...
...
@@ -255,7 +255,7 @@ void test_network_url_scp__malformed_ipv6_with_user(void)
cl_assert_equal_i
(
git_net_url_is_default_port
(
&
conndata
),
1
);
}
void
test_
network_
url_scp__invalid_addresses
(
void
)
void
test_url_scp__invalid_addresses
(
void
)
{
/* Path is required */
cl_git_fail_with
(
GIT_EINVALIDSPEC
,
git_net_url_parse_scp
(
&
conndata
,
...
...
tests/
libgit2/network
/url/valid.c
→
tests/
util
/url/valid.c
View file @
96d2d429
#include "clar_libgit2.h"
#include "net.h"
void
test_
network_
url_valid__test
(
void
)
void
test_url_valid__test
(
void
)
{
cl_assert
(
git_net_str_is_url
(
"http://example.com/"
));
cl_assert
(
git_net_str_is_url
(
"file://localhost/tmp/foo/"
));
...
...
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