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
624924e8
Commit
624924e8
authored
Feb 07, 2013
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote: reorganize tests
parent
390a3c81
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
51 deletions
+51
-51
tests-clar/network/remote/createthenload.c
+3
-3
tests-clar/network/remote/local.c
+6
-6
tests-clar/network/remote/remotes.c
+29
-29
tests-clar/network/remote/rename.c
+13
-13
No files found.
tests-clar/network/
createremo
tethenload.c
→
tests-clar/network/
remote/crea
tethenload.c
View file @
624924e8
...
...
@@ -5,7 +5,7 @@ static git_repository *_repo;
static
git_config
*
_config
;
static
char
url
[]
=
"http://github.com/libgit2/libgit2.git"
;
void
test_network_
createremo
tethenload__initialize
(
void
)
void
test_network_
remote_crea
tethenload__initialize
(
void
)
{
cl_fixture_sandbox
(
"testrepo.git"
);
...
...
@@ -19,7 +19,7 @@ void test_network_createremotethenload__initialize(void)
cl_git_pass
(
git_remote_load
(
&
_remote
,
_repo
,
"origin"
));
}
void
test_network_
createremo
tethenload__cleanup
(
void
)
void
test_network_
remote_crea
tethenload__cleanup
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -30,7 +30,7 @@ void test_network_createremotethenload__cleanup(void)
cl_fixture_cleanup
(
"testrepo.git"
);
}
void
test_network_
createremo
tethenload__parsing
(
void
)
void
test_network_
remote_crea
tethenload__parsing
(
void
)
{
cl_assert_equal_s
(
git_remote_name
(
_remote
),
"origin"
);
cl_assert_equal_s
(
git_remote_url
(
_remote
),
url
);
...
...
tests-clar/network/remotelocal.c
→
tests-clar/network/remote
/
local.c
View file @
624924e8
...
...
@@ -7,13 +7,13 @@ static git_repository *repo;
static
git_buf
file_path_buf
=
GIT_BUF_INIT
;
static
git_remote
*
remote
;
void
test_network_remotelocal__initialize
(
void
)
void
test_network_remote
_
local__initialize
(
void
)
{
cl_git_pass
(
git_repository_init
(
&
repo
,
"remotelocal/"
,
0
));
cl_assert
(
repo
!=
NULL
);
}
void
test_network_remotelocal__cleanup
(
void
)
void
test_network_remote
_
local__cleanup
(
void
)
{
git_buf_free
(
&
file_path_buf
);
...
...
@@ -55,7 +55,7 @@ static void connect_to_local_repository(const char *local_repository)
}
void
test_network_remotelocal__connected
(
void
)
void
test_network_remote
_
local__connected
(
void
)
{
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
cl_assert
(
git_remote_connected
(
remote
));
...
...
@@ -64,7 +64,7 @@ void test_network_remotelocal__connected(void)
cl_assert
(
!
git_remote_connected
(
remote
));
}
void
test_network_remotelocal__retrieve_advertised_references
(
void
)
void
test_network_remote
_
local__retrieve_advertised_references
(
void
)
{
int
how_many_refs
=
0
;
...
...
@@ -75,7 +75,7 @@ void test_network_remotelocal__retrieve_advertised_references(void)
cl_assert_equal_i
(
how_many_refs
,
26
);
}
void
test_network_remotelocal__retrieve_advertised_references_from_spaced_repository
(
void
)
void
test_network_remote
_
local__retrieve_advertised_references_from_spaced_repository
(
void
)
{
int
how_many_refs
=
0
;
...
...
@@ -94,7 +94,7 @@ void test_network_remotelocal__retrieve_advertised_references_from_spaced_reposi
cl_fixture_cleanup
(
"spaced testrepo.git"
);
}
void
test_network_remotelocal__nested_tags_are_completely_peeled
(
void
)
void
test_network_remote
_
local__nested_tags_are_completely_peeled
(
void
)
{
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
...
...
tests-clar/network/remotes.c
→
tests-clar/network/remote
/remote
s.c
View file @
624924e8
...
...
@@ -7,7 +7,7 @@ static git_remote *_remote;
static
git_repository
*
_repo
;
static
const
git_refspec
*
_refspec
;
void
test_network_remotes__initialize
(
void
)
void
test_network_remote
_remote
s__initialize
(
void
)
{
_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
...
...
@@ -17,7 +17,7 @@ void test_network_remotes__initialize(void)
cl_assert
(
_refspec
!=
NULL
);
}
void
test_network_remotes__cleanup
(
void
)
void
test_network_remote
_remote
s__cleanup
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -25,7 +25,7 @@ void test_network_remotes__cleanup(void)
cl_git_sandbox_cleanup
();
}
void
test_network_remotes__parsing
(
void
)
void
test_network_remote
_remote
s__parsing
(
void
)
{
git_remote
*
_remote2
=
NULL
;
...
...
@@ -51,7 +51,7 @@ void test_network_remotes__parsing(void)
git_remote_free
(
_remote2
);
}
void
test_network_remotes__pushurl
(
void
)
void
test_network_remote
_remote
s__pushurl
(
void
)
{
cl_git_pass
(
git_remote_set_pushurl
(
_remote
,
"git://github.com/libgit2/notlibgit2"
));
cl_assert_equal_s
(
git_remote_pushurl
(
_remote
),
"git://github.com/libgit2/notlibgit2"
);
...
...
@@ -60,7 +60,7 @@ void test_network_remotes__pushurl(void)
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
}
void
test_network_remotes__error_when_no_push_available
(
void
)
void
test_network_remote
_remote
s__error_when_no_push_available
(
void
)
{
git_remote
*
r
;
git_transport
*
t
;
...
...
@@ -82,33 +82,33 @@ void test_network_remotes__error_when_no_push_available(void)
git_remote_free
(
r
);
}
void
test_network_remotes__parsing_ssh_remote
(
void
)
void
test_network_remote
_remote
s__parsing_ssh_remote
(
void
)
{
cl_assert
(
git_remote_valid_url
(
"git@github.com:libgit2/libgit2.git"
)
);
}
void
test_network_remotes__parsing_local_path_fails_if_path_not_found
(
void
)
void
test_network_remote
_remote
s__parsing_local_path_fails_if_path_not_found
(
void
)
{
cl_assert
(
!
git_remote_valid_url
(
"/home/git/repos/libgit2.git"
)
);
}
void
test_network_remotes__supported_transport_methods_are_supported
(
void
)
void
test_network_remote
_remote
s__supported_transport_methods_are_supported
(
void
)
{
cl_assert
(
git_remote_supported_url
(
"git://github.com/libgit2/libgit2"
)
);
}
void
test_network_remotes__unsupported_transport_methods_are_unsupported
(
void
)
void
test_network_remote
_remote
s__unsupported_transport_methods_are_unsupported
(
void
)
{
cl_assert
(
!
git_remote_supported_url
(
"git@github.com:libgit2/libgit2.git"
)
);
}
void
test_network_remotes__refspec_parsing
(
void
)
void
test_network_remote
_remote
s__refspec_parsing
(
void
)
{
cl_assert_equal_s
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
);
cl_assert_equal_s
(
git_refspec_dst
(
_refspec
),
"refs/remotes/test/*"
);
}
void
test_network_remotes__set_fetchspec
(
void
)
void
test_network_remote
_remote
s__set_fetchspec
(
void
)
{
cl_git_pass
(
git_remote_set_fetchspec
(
_remote
,
"refs/*:refs/*"
));
_refspec
=
git_remote_fetchspec
(
_remote
);
...
...
@@ -116,7 +116,7 @@ void test_network_remotes__set_fetchspec(void)
cl_assert_equal_s
(
git_refspec_dst
(
_refspec
),
"refs/*"
);
}
void
test_network_remotes__set_pushspec
(
void
)
void
test_network_remote
_remote
s__set_pushspec
(
void
)
{
cl_git_pass
(
git_remote_set_pushspec
(
_remote
,
"refs/*:refs/*"
));
_refspec
=
git_remote_pushspec
(
_remote
);
...
...
@@ -124,7 +124,7 @@ void test_network_remotes__set_pushspec(void)
cl_assert_equal_s
(
git_refspec_dst
(
_refspec
),
"refs/*"
);
}
void
test_network_remotes__save
(
void
)
void
test_network_remote
_remote
s__save
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -165,13 +165,13 @@ void test_network_remotes__save(void)
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
}
void
test_network_remotes__fnmatch
(
void
)
void
test_network_remote
_remote
s__fnmatch
(
void
)
{
cl_assert
(
git_refspec_src_matches
(
_refspec
,
"refs/heads/master"
));
cl_assert
(
git_refspec_src_matches
(
_refspec
,
"refs/heads/multi/level/branch"
));
}
void
test_network_remotes__transform
(
void
)
void
test_network_remote
_remote
s__transform
(
void
)
{
char
ref
[
1024
]
=
{
0
};
...
...
@@ -179,7 +179,7 @@ void test_network_remotes__transform(void)
cl_assert_equal_s
(
ref
,
"refs/remotes/test/master"
);
}
void
test_network_remotes__transform_destination_to_source
(
void
)
void
test_network_remote
_remote
s__transform_destination_to_source
(
void
)
{
char
ref
[
1024
]
=
{
0
};
...
...
@@ -187,7 +187,7 @@ void test_network_remotes__transform_destination_to_source(void)
cl_assert_equal_s
(
ref
,
"refs/heads/master"
);
}
void
test_network_remotes__transform_r
(
void
)
void
test_network_remote
_remote
s__transform_r
(
void
)
{
git_buf
buf
=
GIT_BUF_INIT
;
...
...
@@ -196,7 +196,7 @@ void test_network_remotes__transform_r(void)
git_buf_free
(
&
buf
);
}
void
test_network_remotes__missing_refspecs
(
void
)
void
test_network_remote
_remote
s__missing_refspecs
(
void
)
{
git_config
*
cfg
;
...
...
@@ -210,7 +210,7 @@ void test_network_remotes__missing_refspecs(void)
git_config_free
(
cfg
);
}
void
test_network_remotes__list
(
void
)
void
test_network_remote
_remote
s__list
(
void
)
{
git_strarray
list
;
git_config
*
cfg
;
...
...
@@ -228,7 +228,7 @@ void test_network_remotes__list(void)
git_config_free
(
cfg
);
}
void
test_network_remotes__loading_a_missing_remote_returns_ENOTFOUND
(
void
)
void
test_network_remote
_remote
s__loading_a_missing_remote_returns_ENOTFOUND
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -236,7 +236,7 @@ void test_network_remotes__loading_a_missing_remote_returns_ENOTFOUND(void)
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_remote_load
(
&
_remote
,
_repo
,
"just-left-few-minutes-ago"
));
}
void
test_network_remotes__loading_with_an_invalid_name_returns_EINVALIDSPEC
(
void
)
void
test_network_remote
_remote
s__loading_with_an_invalid_name_returns_EINVALIDSPEC
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -253,7 +253,7 @@ void test_network_remotes__loading_with_an_invalid_name_returns_EINVALIDSPEC(voi
* url = http://github.com/libgit2/libgit2
* fetch = +refs/heads/\*:refs/remotes/addtest/\*
*/
void
test_network_remotes__add
(
void
)
void
test_network_remote
_remote
s__add
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -271,7 +271,7 @@ void test_network_remotes__add(void)
cl_assert_equal_s
(
git_remote_url
(
_remote
),
"http://github.com/libgit2/libgit2"
);
}
void
test_network_remotes__cannot_add_a_nameless_remote
(
void
)
void
test_network_remote
_remote
s__cannot_add_a_nameless_remote
(
void
)
{
git_remote
*
remote
;
...
...
@@ -280,7 +280,7 @@ void test_network_remotes__cannot_add_a_nameless_remote(void)
git_remote_create
(
&
remote
,
_repo
,
NULL
,
"git://github.com/libgit2/libgit2"
));
}
void
test_network_remotes__cannot_save_an_inmemory_remote
(
void
)
void
test_network_remote
_remote
s__cannot_save_an_inmemory_remote
(
void
)
{
git_remote
*
remote
;
...
...
@@ -292,7 +292,7 @@ void test_network_remotes__cannot_save_an_inmemory_remote(void)
git_remote_free
(
remote
);
}
void
test_network_remotes__cannot_add_a_remote_with_an_invalid_name
(
void
)
void
test_network_remote
_remote
s__cannot_add_a_remote_with_an_invalid_name
(
void
)
{
git_remote
*
remote
=
NULL
;
...
...
@@ -307,7 +307,7 @@ void test_network_remotes__cannot_add_a_remote_with_an_invalid_name(void)
cl_assert_equal_p
(
remote
,
NULL
);
}
void
test_network_remotes__tagopt
(
void
)
void
test_network_remote
_remote
s__tagopt
(
void
)
{
const
char
*
opt
;
git_config
*
cfg
;
...
...
@@ -331,7 +331,7 @@ void test_network_remotes__tagopt(void)
git_config_free
(
cfg
);
}
void
test_network_remotes__cannot_load_with_an_empty_url
(
void
)
void
test_network_remote
_remote
s__cannot_load_with_an_empty_url
(
void
)
{
git_remote
*
remote
=
NULL
;
...
...
@@ -340,7 +340,7 @@ void test_network_remotes__cannot_load_with_an_empty_url(void)
cl_assert_equal_p
(
remote
,
NULL
);
}
void
test_network_remotes__check_structure_version
(
void
)
void
test_network_remote
_remote
s__check_structure_version
(
void
)
{
git_transport
transport
=
GIT_TRANSPORT_INIT
;
const
git_error
*
err
;
...
...
@@ -361,7 +361,7 @@ void test_network_remotes__check_structure_version(void)
cl_assert_equal_i
(
GITERR_INVALID
,
err
->
klass
);
}
void
test_network_remotes__cannot_create_a_remote_which_name_conflicts_with_an_existing_remote
(
void
)
void
test_network_remote
_remote
s__cannot_create_a_remote_which_name_conflicts_with_an_existing_remote
(
void
)
{
git_remote
*
remote
=
NULL
;
...
...
tests-clar/network/remoterename.c
→
tests-clar/network/remote
/
rename.c
View file @
624924e8
...
...
@@ -6,14 +6,14 @@
static
git_remote
*
_remote
;
static
git_repository
*
_repo
;
void
test_network_remoterename__initialize
(
void
)
void
test_network_remote
_
rename__initialize
(
void
)
{
_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_remote_load
(
&
_remote
,
_repo
,
"test"
));
}
void
test_network_remoterename__cleanup
(
void
)
void
test_network_remote
_
rename__cleanup
(
void
)
{
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -31,7 +31,7 @@ static int dont_call_me_cb(const char *fetch_refspec, void *payload)
return
-
1
;
}
void
test_network_remoterename__renaming_a_remote_moves_related_configuration_section
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_moves_related_configuration_section
(
void
)
{
assert_config_entry_existence
(
_repo
,
"remote.test.fetch"
,
true
);
assert_config_entry_existence
(
_repo
,
"remote.just/renamed.fetch"
,
false
);
...
...
@@ -42,7 +42,7 @@ void test_network_remoterename__renaming_a_remote_moves_related_configuration_se
assert_config_entry_existence
(
_repo
,
"remote.just/renamed.fetch"
,
true
);
}
void
test_network_remoterename__renaming_a_remote_updates_branch_related_configuration_entries
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_updates_branch_related_configuration_entries
(
void
)
{
assert_config_entry_value
(
_repo
,
"branch.master.remote"
,
"test"
);
...
...
@@ -51,14 +51,14 @@ void test_network_remoterename__renaming_a_remote_updates_branch_related_configu
assert_config_entry_value
(
_repo
,
"branch.master.remote"
,
"just/renamed"
);
}
void
test_network_remoterename__renaming_a_remote_updates_default_fetchrefspec
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_updates_default_fetchrefspec
(
void
)
{
cl_git_pass
(
git_remote_rename
(
_remote
,
"just/renamed"
,
dont_call_me_cb
,
NULL
));
assert_config_entry_value
(
_repo
,
"remote.just/renamed.fetch"
,
"+refs/heads/*:refs/remotes/just/renamed/*"
);
}
void
test_network_remoterename__renaming_a_remote_without_a_fetchrefspec_doesnt_create_one
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_without_a_fetchrefspec_doesnt_create_one
(
void
)
{
git_config
*
config
;
...
...
@@ -94,7 +94,7 @@ static int ensure_refspecs(const char* refspec_name, void *payload)
return
0
;
}
void
test_network_remoterename__renaming_a_remote_notifies_of_non_default_fetchrefspec
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_notifies_of_non_default_fetchrefspec
(
void
)
{
git_config
*
config
;
...
...
@@ -113,20 +113,20 @@ void test_network_remoterename__renaming_a_remote_notifies_of_non_default_fetchr
assert_config_entry_value
(
_repo
,
"remote.just/renamed.fetch"
,
"+refs/*:refs/*"
);
}
void
test_network_remoterename__new_name_can_contain_dots
(
void
)
void
test_network_remote
_
rename__new_name_can_contain_dots
(
void
)
{
cl_git_pass
(
git_remote_rename
(
_remote
,
"just.renamed"
,
dont_call_me_cb
,
NULL
));
cl_assert_equal_s
(
"just.renamed"
,
git_remote_name
(
_remote
));
}
void
test_network_remoterename__new_name_must_conform_to_reference_naming_conventions
(
void
)
void
test_network_remote
_
rename__new_name_must_conform_to_reference_naming_conventions
(
void
)
{
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_remote_rename
(
_remote
,
"new@{name"
,
dont_call_me_cb
,
NULL
));
}
void
test_network_remoterename__renamed_name_is_persisted
(
void
)
void
test_network_remote
_
rename__renamed_name_is_persisted
(
void
)
{
git_remote
*
renamed
;
git_repository
*
another_repo
;
...
...
@@ -142,13 +142,13 @@ void test_network_remoterename__renamed_name_is_persisted(void)
git_repository_free
(
another_repo
);
}
void
test_network_remoterename__cannot_overwrite_an_existing_remote
(
void
)
void
test_network_remote
_
rename__cannot_overwrite_an_existing_remote
(
void
)
{
cl_assert_equal_i
(
GIT_EEXISTS
,
git_remote_rename
(
_remote
,
"test"
,
dont_call_me_cb
,
NULL
));
cl_assert_equal_i
(
GIT_EEXISTS
,
git_remote_rename
(
_remote
,
"test_with_pushurl"
,
dont_call_me_cb
,
NULL
));
}
void
test_network_remoterename__renaming_a_remote_moves_the_underlying_reference
(
void
)
void
test_network_remote
_
rename__renaming_a_remote_moves_the_underlying_reference
(
void
)
{
git_reference
*
underlying
;
...
...
@@ -163,7 +163,7 @@ void test_network_remoterename__renaming_a_remote_moves_the_underlying_reference
git_reference_free
(
underlying
);
}
void
test_network_remoterename__cannot_rename_an_inmemory_remote
(
void
)
void
test_network_remote
_
rename__cannot_rename_an_inmemory_remote
(
void
)
{
git_remote
*
remote
;
...
...
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