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
6b02b215
Commit
6b02b215
authored
Mar 03, 2011
by
nulltoken
Committed by
Vicent Marti
Mar 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test renameref::can_not_rename_a_reference_with_an_invalid_name()
parent
129007b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/t10-refs.c
+23
-0
No files found.
tests/t10-refs.c
View file @
6b02b215
...
...
@@ -415,6 +415,28 @@ BEGIN_TEST("renameref", can_not_rename_a_reference_with_the_name_of_an_existing_
git_repository_free
(
repo
);
END_TEST
BEGIN_TEST
(
"renameref"
,
can_not_rename_a_reference_with_an_invalid_name
)
git_reference
*
looked_up_ref
;
git_repository
*
repo
;
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
/* An existing oid reference... */
must_pass
(
git_repository_lookup_ref
(
&
looked_up_ref
,
repo
,
packed_test_head_name
));
/* Can not be renamed with an invalid name. */
must_fail
(
git_reference_rename
(
looked_up_ref
,
"Hello! I'm a very invalid name."
));
/* Can not be renamed outside of the refs hierarchy. */
must_fail
(
git_reference_rename
(
looked_up_ref
,
"i-will-sudo-you"
));
/* Failure to rename it hasn't corrupted its state */
must_pass
(
git_repository_lookup_ref
(
&
looked_up_ref
,
repo
,
packed_test_head_name
));
must_be_true
(
!
strcmp
(
looked_up_ref
->
name
,
packed_test_head_name
));
git_repository_free
(
repo
);
END_TEST
static
int
ensure_refname_normalized
(
int
is_oid_ref
,
const
char
*
input_refname
,
const
char
*
expected_refname
)
{
int
error
=
GIT_SUCCESS
;
...
...
@@ -617,5 +639,6 @@ git_testsuite *libgit2_suite_refs(void)
ADD_TEST
(
suite
,
"packrefs"
,
create_packfile
);
ADD_TEST
(
suite
,
"renameref"
,
renaming_a_packed_reference_makes_it_loose
);
ADD_TEST
(
suite
,
"renameref"
,
can_not_rename_a_reference_with_the_name_of_an_existing_reference
);
ADD_TEST
(
suite
,
"renameref"
,
can_not_rename_a_reference_with_an_invalid_name
);
return
suite
;
}
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