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
67d334c1
Commit
67d334c1
authored
Jun 11, 2012
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: add more tests for writing escaped chars
parent
49938cad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
tests-clar/config/write.c
+29
-0
No files found.
tests-clar/config/write.c
View file @
67d334c1
...
@@ -106,4 +106,33 @@ void test_config_write__value_containing_quotes(void)
...
@@ -106,4 +106,33 @@ void test_config_write__value_containing_quotes(void)
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
"this
\"
has
\"
quotes"
);
cl_assert_equal_s
(
str
,
"this
\"
has
\"
quotes"
);
git_config_free
(
cfg
);
git_config_free
(
cfg
);
/* The code path for values that already exist is different, check that one as well */
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_set_string
(
cfg
,
"core.somevar"
,
"this also
\"
has
\"
quotes"
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
"this also
\"
has
\"
quotes"
);
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
"this also
\"
has
\"
quotes"
);
git_config_free
(
cfg
);
}
void
test_config_write__escape_value
(
void
)
{
git_config
*
cfg
;
const
char
*
str
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_set_string
(
cfg
,
"core.somevar"
,
"this
\"
has
\"
quotes and
\t
"
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
"this
\"
has
\"
quotes and
\t
"
);
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.somevar"
));
cl_assert_equal_s
(
str
,
"this
\"
has
\"
quotes and
\t
"
);
git_config_free
(
cfg
);
}
}
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