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
255c38c5
Commit
255c38c5
authored
May 10, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
global: Fix unit tests after reordering
parent
29e948de
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
82 deletions
+82
-82
tests-clar/attr/flags.c
+29
-29
tests-clar/attr/repo.c
+13
-13
tests-clar/config/add.c
+2
-2
tests-clar/config/new.c
+2
-2
tests-clar/config/read.c
+26
-26
tests-clar/config/stress.c
+5
-5
tests-clar/config/write.c
+5
-5
No files found.
tests-clar/attr/flags.c
View file @
255c38c5
...
...
@@ -14,7 +14,7 @@ void test_attr_flags__bare(void)
cl_assert
(
git_repository_is_bare
(
repo
));
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
,
"README.md"
,
"diff"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
,
"README.md"
,
"diff"
));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
value
));
}
...
...
@@ -27,34 +27,34 @@ void test_attr_flags__index_vs_workdir(void)
/* wd then index */
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.md"
,
"bar"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.md"
,
"bar"
));
cl_assert
(
GIT_ATTR_FALSE
(
value
));
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.md"
,
"blargh"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.md"
,
"blargh"
));
cl_assert_equal_s
(
value
,
"goop"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.txt"
,
"foo"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"README.txt"
,
"foo"
));
cl_assert
(
GIT_ATTR_FALSE
(
value
));
/* index then wd */
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.md"
,
"bar"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.md"
,
"bar"
));
cl_assert
(
GIT_ATTR_TRUE
(
value
));
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.md"
,
"blargh"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.md"
,
"blargh"
));
cl_assert_equal_s
(
value
,
"garble"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.txt"
,
"foo"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"README.txt"
,
"foo"
));
cl_assert
(
GIT_ATTR_TRUE
(
value
));
}
...
...
@@ -65,44 +65,44 @@ void test_attr_flags__subdir(void)
/* wd then index */
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.md"
,
"bar"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.md"
,
"bar"
));
cl_assert_equal_s
(
value
,
"1234"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"another"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"another"
));
cl_assert_equal_s
(
value
,
"one"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"again"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"again"
));
cl_assert
(
GIT_ATTR_TRUE
(
value
));
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"beep"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_FILE_THEN_INDEX
,
"sub/sub/README.txt"
,
"beep"
));
cl_assert_equal_s
(
value
,
"10"
);
/* index then wd */
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.md"
,
"bar"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.md"
,
"bar"
));
cl_assert_equal_s
(
value
,
"1337"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"another"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"another"
));
cl_assert_equal_s
(
value
,
"one"
);
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"again"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"again"
));
cl_assert
(
GIT_ATTR_TRUE
(
value
));
cl_git_pass
(
git_attr_get
(
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"beep"
,
&
value
));
&
value
,
repo
,
GIT_ATTR_CHECK_NO_SYSTEM
|
GIT_ATTR_CHECK_INDEX_THEN_FILE
,
"sub/sub/README.txt"
,
"beep"
));
cl_assert_equal_s
(
value
,
"5"
);
}
tests-clar/attr/repo.c
View file @
255c38c5
...
...
@@ -64,7 +64,7 @@ void test_attr_repo__get_one(void)
for
(
scan
=
test_cases
;
scan
->
path
!=
NULL
;
scan
++
)
{
const
char
*
value
;
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
scan
->
path
,
scan
->
attr
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
scan
->
path
,
scan
->
attr
));
attr_check_expected
(
scan
->
expected
,
scan
->
expected_str
,
value
);
}
...
...
@@ -78,21 +78,21 @@ void test_attr_repo__get_many(void)
const
char
*
names
[
4
]
=
{
"repoattr"
,
"rootattr"
,
"missingattr"
,
"subattr"
};
const
char
*
values
[
4
];
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"root_test1"
,
4
,
names
,
valu
es
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"root_test1"
,
4
,
nam
es
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
1
]));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
2
]));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
3
]));
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"root_test2"
,
4
,
names
,
valu
es
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"root_test2"
,
4
,
nam
es
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_FALSE
(
values
[
1
]));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
2
]));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
3
]));
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"sub/subdir_test1"
,
4
,
names
,
valu
es
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"sub/subdir_test1"
,
4
,
nam
es
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
1
]));
...
...
@@ -137,19 +137,19 @@ void test_attr_repo__manpage_example(void)
{
const
char
*
value
;
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
"sub/abc"
,
"foo"
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
"sub/abc"
,
"foo"
));
cl_assert
(
GIT_ATTR_TRUE
(
value
));
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
"sub/abc"
,
"bar"
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
"sub/abc"
,
"bar"
));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
value
));
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
"sub/abc"
,
"baz"
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
"sub/abc"
,
"baz"
));
cl_assert
(
GIT_ATTR_FALSE
(
value
));
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
"sub/abc"
,
"merge"
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
"sub/abc"
,
"merge"
));
cl_assert_equal_s
(
"filfre"
,
value
);
cl_git_pass
(
git_attr_get
(
g_repo
,
0
,
"sub/abc"
,
"frotz"
,
&
value
));
cl_git_pass
(
git_attr_get
(
&
value
,
g_repo
,
0
,
"sub/abc"
,
"frotz"
));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
value
));
}
...
...
@@ -160,7 +160,7 @@ void test_attr_repo__macros(void)
const
char
*
names3
[
3
]
=
{
"macro2"
,
"multi2"
,
"multi3"
};
const
char
*
values
[
5
];
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"binfile"
,
5
,
names
,
valu
es
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"binfile"
,
5
,
nam
es
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
1
]));
...
...
@@ -168,7 +168,7 @@ void test_attr_repo__macros(void)
cl_assert
(
GIT_ATTR_FALSE
(
values
[
3
]));
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
4
]));
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"macro_test"
,
5
,
names2
,
values
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"macro_test"
,
5
,
names2
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
1
]));
...
...
@@ -176,7 +176,7 @@ void test_attr_repo__macros(void)
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
3
]));
cl_assert_equal_s
(
"77"
,
values
[
4
]);
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"macro_test"
,
3
,
names3
,
values
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"macro_test"
,
3
,
names3
));
cl_assert
(
GIT_ATTR_TRUE
(
values
[
0
]));
cl_assert
(
GIT_ATTR_FALSE
(
values
[
1
]));
...
...
@@ -189,7 +189,7 @@ void test_attr_repo__bad_macros(void)
"firstmacro"
,
"secondmacro"
,
"thirdmacro"
};
const
char
*
values
[
6
];
cl_git_pass
(
git_attr_get_many
(
g_repo
,
0
,
"macro_bad"
,
6
,
names
,
valu
es
));
cl_git_pass
(
git_attr_get_many
(
values
,
g_repo
,
0
,
"macro_bad"
,
6
,
nam
es
));
/* these three just confirm that the "mymacro" rule ran */
cl_assert
(
GIT_ATTR_UNSPECIFIED
(
values
[
0
]));
...
...
tests-clar/config/add.c
View file @
255c38c5
...
...
@@ -17,7 +17,7 @@ void test_config_add__to_existing_section(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config10"
));
cl_git_pass
(
git_config_set_int32
(
cfg
,
"empty.tmp"
,
5
));
cl_git_pass
(
git_config_get_int32
(
cfg
,
"empty.tmp"
,
&
i
));
cl_git_pass
(
git_config_get_int32
(
&
i
,
cfg
,
"empty.tmp"
));
cl_assert
(
i
==
5
);
cl_git_pass
(
git_config_delete
(
cfg
,
"empty.tmp"
));
git_config_free
(
cfg
);
...
...
@@ -30,7 +30,7 @@ void test_config_add__to_new_section(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config10"
));
cl_git_pass
(
git_config_set_int32
(
cfg
,
"section.tmp"
,
5
));
cl_git_pass
(
git_config_get_int32
(
cfg
,
"section.tmp"
,
&
i
));
cl_git_pass
(
git_config_get_int32
(
&
i
,
cfg
,
"section.tmp"
));
cl_assert
(
i
==
5
);
cl_git_pass
(
git_config_delete
(
cfg
,
"section.tmp"
));
git_config_free
(
cfg
);
...
...
tests-clar/config/new.c
View file @
255c38c5
...
...
@@ -25,9 +25,9 @@ void test_config_new__write_new_config(void)
cl_git_pass
(
git_config_new
(
&
config
));
cl_git_pass
(
git_config_add_file
(
config
,
file
,
0
));
cl_git_pass
(
git_config_get_string
(
config
,
"color.ui"
,
&
out
));
cl_git_pass
(
git_config_get_string
(
&
out
,
config
,
"color.ui"
));
cl_assert_equal_s
(
out
,
"auto"
);
cl_git_pass
(
git_config_get_string
(
config
,
"core.editor"
,
&
out
));
cl_git_pass
(
git_config_get_string
(
&
out
,
config
,
"core.editor"
));
cl_assert_equal_s
(
out
,
"ed"
);
git_config_free
(
config
);
...
...
tests-clar/config/read.c
View file @
255c38c5
...
...
@@ -7,13 +7,13 @@ void test_config_read__simple_read(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config0"
)));
cl_git_pass
(
git_config_get_int32
(
cfg
,
"core.repositoryformatversion"
,
&
i
));
cl_git_pass
(
git_config_get_int32
(
&
i
,
cfg
,
"core.repositoryformatversion"
));
cl_assert
(
i
==
0
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"core.filemode"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"core.filemode"
));
cl_assert
(
i
==
1
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"core.bare"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"core.bare"
));
cl_assert
(
i
==
0
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"core.logallrefupdates"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"core.logallrefupdates"
));
cl_assert
(
i
==
1
);
git_config_free
(
cfg
);
...
...
@@ -27,18 +27,18 @@ void test_config_read__case_sensitive(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config1"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.that.other"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"this.that.other"
));
cl_assert_equal_s
(
str
,
"true"
);
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.That.other"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"this.That.other"
));
cl_assert_equal_s
(
str
,
"yes"
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"this.that.other"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"this.that.other"
));
cl_assert
(
i
==
1
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"this.That.other"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"this.That.other"
));
cl_assert
(
i
==
1
);
/* This one doesn't exist */
cl_must_fail
(
git_config_get_bool
(
cfg
,
"this.thaT.other"
,
&
i
));
cl_must_fail
(
git_config_get_bool
(
&
i
,
cfg
,
"this.thaT.other"
));
git_config_free
(
cfg
);
}
...
...
@@ -54,7 +54,7 @@ void test_config_read__multiline_value(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config2"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"this.That.and"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"this.That.and"
));
cl_assert_equal_s
(
str
,
"one one one two two three three"
);
git_config_free
(
cfg
);
...
...
@@ -70,11 +70,11 @@ void test_config_read__subsection_header(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config3"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"section.subsection.var"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"section.subsection.var"
));
cl_assert_equal_s
(
str
,
"hello"
);
/* The subsection is transformed to lower-case */
cl_must_fail
(
git_config_get_string
(
cfg
,
"section.subSectIon.var"
,
&
str
));
cl_must_fail
(
git_config_get_string
(
&
str
,
cfg
,
"section.subSectIon.var"
));
git_config_free
(
cfg
);
}
...
...
@@ -87,10 +87,10 @@ void test_config_read__lone_variable(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config4"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"some.section.variable"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"some.section.variable"
));
cl_assert
(
str
==
NULL
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"some.section.variable"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"some.section.variable"
));
cl_assert
(
i
==
1
);
git_config_free
(
cfg
);
...
...
@@ -103,25 +103,25 @@ void test_config_read__number_suffixes(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config5"
)));
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.simple"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.simple"
));
cl_assert
(
i
==
1
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.k"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.k"
));
cl_assert
(
i
==
1
*
1024
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.kk"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.kk"
));
cl_assert
(
i
==
1
*
1024
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.m"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.m"
));
cl_assert
(
i
==
1
*
1024
*
1024
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.mm"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.mm"
));
cl_assert
(
i
==
1
*
1024
*
1024
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.g"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.g"
));
cl_assert
(
i
==
1
*
1024
*
1024
*
1024
);
cl_git_pass
(
git_config_get_int64
(
cfg
,
"number.gg"
,
&
i
));
cl_git_pass
(
git_config_get_int64
(
&
i
,
cfg
,
"number.gg"
));
cl_assert
(
i
==
1
*
1024
*
1024
*
1024
);
git_config_free
(
cfg
);
...
...
@@ -134,10 +134,10 @@ void test_config_read__blank_lines(void)
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config6"
)));
cl_git_pass
(
git_config_get_bool
(
cfg
,
"valid.subsection.something"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"valid.subsection.something"
));
cl_assert
(
i
==
1
);
cl_git_pass
(
git_config_get_bool
(
cfg
,
"something.else.something"
,
&
i
));
cl_git_pass
(
git_config_get_bool
(
&
i
,
cfg
,
"something.else.something"
));
cl_assert
(
i
==
0
);
git_config_free
(
cfg
);
...
...
@@ -170,10 +170,10 @@ void test_config_read__prefixes(void)
const
char
*
str
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config9"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"remote.ab.url"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"remote.ab.url"
));
cl_assert_equal_s
(
str
,
"http://example.com/git/ab"
);
cl_git_pass
(
git_config_get_string
(
cfg
,
"remote.abba.url"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"remote.abba.url"
));
cl_assert_equal_s
(
str
,
"http://example.com/git/abba"
);
git_config_free
(
cfg
);
...
...
@@ -185,7 +185,7 @@ void test_config_read__escaping_quotes(void)
const
char
*
str
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
cl_fixture
(
"config/config13"
)));
cl_git_pass
(
git_config_get_string
(
cfg
,
"core.editor"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"core.editor"
));
cl_assert
(
strcmp
(
str
,
"
\"
C:/Program Files/Nonsense/bah.exe
\"
\"
--some option
\"
"
)
==
0
);
git_config_free
(
cfg
);
...
...
tests-clar/config/stress.c
View file @
255c38c5
...
...
@@ -32,8 +32,8 @@ void test_config_stress__dont_break_on_invalid_input(void)
cl_git_pass
(
git_config_new
(
&
config
));
cl_git_pass
(
git_config_add_file
(
config
,
file
,
0
));
cl_git_pass
(
git_config_get_string
(
config
,
"color.ui"
,
&
color
));
cl_git_pass
(
git_config_get_string
(
config
,
"core.editor"
,
&
editor
));
cl_git_pass
(
git_config_get_string
(
&
color
,
config
,
"color.ui"
));
cl_git_pass
(
git_config_get_string
(
&
editor
,
config
,
"core.editor"
));
git_config_free
(
config
);
}
...
...
@@ -48,13 +48,13 @@ void test_config_stress__comments(void)
cl_git_pass
(
git_config_new
(
&
config
));
cl_git_pass
(
git_config_add_file
(
config
,
file
,
0
));
cl_git_pass
(
git_config_get_string
(
config
,
"some.section.other"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
config
,
"some.section.other"
));
cl_assert
(
!
strcmp
(
str
,
"hello!
\"
; ; ; "
));
cl_git_pass
(
git_config_get_string
(
config
,
"some.section.multi"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
config
,
"some.section.multi"
));
cl_assert
(
!
strcmp
(
str
,
"hi, this is a ; multiline comment # with ;
\n
special chars and other stuff !@#"
));
cl_git_pass
(
git_config_get_string
(
config
,
"some.section.back"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
config
,
"some.section.back"
));
cl_assert
(
!
strcmp
(
str
,
"this is
\b
a phrase"
));
git_config_free
(
config
);
...
...
tests-clar/config/write.c
View file @
255c38c5
...
...
@@ -22,7 +22,7 @@ void test_config_write__replace_value(void)
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_get_int32
(
cfg
,
"core.dummy"
,
&
i
));
cl_git_pass
(
git_config_get_int32
(
&
i
,
cfg
,
"core.dummy"
));
cl_assert
(
i
==
5
);
git_config_free
(
cfg
);
...
...
@@ -35,12 +35,12 @@ void test_config_write__replace_value(void)
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_get_int64
(
cfg
,
"core.verylong"
,
&
l
));
cl_git_pass
(
git_config_get_int64
(
&
l
,
cfg
,
"core.verylong"
));
cl_assert
(
l
==
expected
);
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_must_fail
(
git_config_get_int32
(
cfg
,
"core.verylong"
,
&
i
));
cl_must_fail
(
git_config_get_int32
(
&
i
,
cfg
,
"core.verylong"
));
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
...
...
@@ -62,7 +62,7 @@ void test_config_write__delete_value(void)
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_assert
(
git_config_get_int32
(
cfg
,
"core.dummy"
,
&
i
)
==
GIT_ENOTFOUND
);
cl_assert
(
git_config_get_int32
(
&
i
,
cfg
,
"core.dummy"
)
==
GIT_ENOTFOUND
);
cl_git_pass
(
git_config_set_int32
(
cfg
,
"core.dummy"
,
1
));
git_config_free
(
cfg
);
}
...
...
@@ -77,7 +77,7 @@ void test_config_write__write_subsection(void)
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_get_string
(
cfg
,
"my.own.var"
,
&
str
));
cl_git_pass
(
git_config_get_string
(
&
str
,
cfg
,
"my.own.var"
));
cl_git_pass
(
strcmp
(
str
,
"works"
));
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