Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Sumaid
tracker-miners
Commits
6b9340eb
Commit
6b9340eb
authored
Mar 18, 2019
by
Andrea Azzarone
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Fix memory leaks
Closes:
GNOME/tracker-miners#59
parent
67958708
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
0 deletions
+26
-0
tests/libtracker-extract/tracker-exif-test.c
tests/libtracker-extract/tracker-exif-test.c
+2
-0
tests/libtracker-extract/tracker-iptc-test.c
tests/libtracker-extract/tracker-iptc-test.c
+2
-0
tests/libtracker-extract/tracker-utils-test.c
tests/libtracker-extract/tracker-utils-test.c
+6
-0
tests/libtracker-extract/tracker-xmp-test.c
tests/libtracker-extract/tracker-xmp-test.c
+5
-0
tests/libtracker-miners-common/tracker-date-time-test.c
tests/libtracker-miners-common/tracker-date-time-test.c
+6
-0
tests/libtracker-miners-common/tracker-file-utils-test.c
tests/libtracker-miners-common/tracker-file-utils-test.c
+3
-0
tests/libtracker-miners-common/tracker-type-utils-test.c
tests/libtracker-miners-common/tracker-type-utils-test.c
+2
-0
No files found.
tests/libtracker-extract/tracker-exif-test.c
View file @
6b9340eb
...
...
@@ -66,6 +66,7 @@ test_exif_parse (void)
g_assert_cmpstr
(
exif
->
gps_direction
,
==
,
"12.3"
);
// -n -Exif:GPSImgDirection=12.3
tracker_exif_free
(
exif
);
g_free
(
blob
);
}
static
void
...
...
@@ -80,6 +81,7 @@ test_exif_parse_empty (void)
exif
=
tracker_exif_new
((
guchar
*
)
blob
,
length
,
"test://file"
);
tracker_exif_free
(
exif
);
g_free
(
blob
);
}
int
...
...
tests/libtracker-extract/tracker-iptc-test.c
View file @
6b9340eb
...
...
@@ -120,6 +120,8 @@ load_iptc_blob (const gchar *filename)
marker
=
marker
->
next
;
}
jpeg_destroy_decompress
(
&
cinfo
);
g_free
(
uri
);
fclose
(
f
);
...
...
tests/libtracker-extract/tracker-utils-test.c
View file @
6b9340eb
...
...
@@ -213,6 +213,7 @@ test_date_to_iso8601 ()
result
=
tracker_date_format_to_iso8601
(
"2010:03:13 12:12:12"
,
"%Y:%m:%d %H:%M:%S"
);
g_assert
(
g_str_has_prefix
(
result
,
"2010-03-13T12:12:12"
));
g_assert_cmpint
(
strlen
(
result
),
<=
,
25
);
g_free
(
result
);
/* Pattern and string don't match */
result
=
tracker_date_format_to_iso8601
(
"2010:03:13 12:12"
,
"%Y:%m:%d %H:%M:%S"
);
...
...
@@ -268,12 +269,17 @@ test_getline (void)
f
=
fopen
(
TOP_SRCDIR
"/tests/libtracker-extract/getline-test.txt"
,
"r"
);
g_assert_cmpint
(
tracker_getline
(
&
line
,
&
n
,
f
),
>
,
0
);
g_assert_cmpstr
(
line
,
==
,
"Line 1
\n
"
);
g_free
(
line
);
line
=
NULL
;
g_assert_cmpint
(
tracker_getline
(
&
line
,
&
n
,
f
),
>
,
0
);
g_assert_cmpstr
(
line
,
==
,
"line 2
\n
"
);
g_free
(
line
);
line
=
NULL
;
g_assert_cmpint
(
tracker_getline
(
&
line
,
&
n
,
f
),
>
,
0
);
g_assert_cmpstr
(
line
,
==
,
"line 3
\n
"
);
g_free
(
line
);
}
int
...
...
tests/libtracker-extract/tracker-xmp-test.c
View file @
6b9340eb
...
...
@@ -328,6 +328,11 @@ test_xmp_apply_location (void)
g_assert_cmpstr
(
tracker_resource_get_first_string
(
address
,
"nco:region"
),
==
,
data
.
state
);
g_assert_cmpstr
(
tracker_resource_get_first_string
(
address
,
"nco:locality"
),
==
,
data
.
city
);
g_assert_cmpstr
(
tracker_resource_get_first_string
(
address
,
"nco:country"
),
==
,
data
.
country
);
g_free
(
data
.
address
);
g_free
(
data
.
city
);
g_free
(
data
.
state
);
g_free
(
data
.
country
);
}
...
...
tests/libtracker-miners-common/tracker-date-time-test.c
View file @
6b9340eb
...
...
@@ -110,6 +110,9 @@ test_string_to_date (void)
/* More cases of string->date are tested in tracker_date_time_from_string...
* it is more convinient to test them there
*/
g_date_free
(
result
);
g_date_free
(
expected
);
}
static
void
...
...
@@ -137,6 +140,9 @@ test_date_to_string (void)
result
=
tracker_date_to_string
(
input
);
g_assert
(
result
!=
NULL
&&
strncmp
(
result
,
"2008-06-16T23:53:10Z"
,
19
)
==
0
);
g_free
(
result
);
g_free
(
original
);
}
static
void
...
...
tests/libtracker-miners-common/tracker-file-utils-test.c
View file @
6b9340eb
...
...
@@ -168,6 +168,7 @@ test_path_evaluate_name (void)
result
=
tracker_path_evaluate_name
(
"just-a-filename"
);
g_assert_cmpstr
(
result
,
==
,
"just-a-filename"
);
g_free
(
result
);
result
=
tracker_path_evaluate_name
(
"$HOME/all/dir/"
);
expected
=
g_build_path
(
G_DIR_SEPARATOR_S
,
home
,
"/all/dir"
,
NULL
);
...
...
@@ -215,9 +216,11 @@ test_path_evaluate_name (void)
result
=
tracker_path_evaluate_name
(
"$UNDEFINED/something"
);
g_assert_cmpstr
(
result
,
==
,
"/something"
);
g_free
(
result
);
result
=
tracker_path_evaluate_name
(
tracker_test_helpers_get_nonutf8
());
g_assert_cmpstr
(
result
,
==
,
tracker_test_helpers_get_nonutf8
());
g_free
(
result
);
g_free
(
home
);
g_free
(
pwd
);
...
...
tests/libtracker-miners-common/tracker-type-utils-test.c
View file @
6b9340eb
...
...
@@ -58,6 +58,7 @@ test_string_in_string_list (void)
g_assert_cmpint
(
tracker_string_in_string_list
(
"Audio:Title"
,
pieces
),
==
,
12
);
g_assert_cmpint
(
tracker_string_in_string_list
(
"terms"
,
NULL
),
==
,
-
1
);
g_strfreev
(
pieces
);
}
static
void
...
...
@@ -143,6 +144,7 @@ test_string_to_string_list (void)
result
=
tracker_string_to_string_list
(
input
);
g_assert_cmpint
(
g_strv_length
(
result
),
==
,
1
);
g_assert_cmpstr
(
result
[
0
],
==
,
"first line"
);
g_strfreev
(
result
);
}
static
void
...
...
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