[grilo-plugins] metrolyrics: Add debug helper to the tests



commit f0f14a4fdfdbf1d70b0b28a2a18119da5f8ab4fa
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 18 18:08:59 2018 +0200

    metrolyrics: Add debug helper to the tests
    
    Save the "computed" lyrics to a temporary file on disk, so as to avoid
    having to guess how to have it downloaded and processed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795361

 tests/lua-factory/sources/test_lua_metrolyrics.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/tests/lua-factory/sources/test_lua_metrolyrics.c 
b/tests/lua-factory/sources/test_lua_metrolyrics.c
index 391969e..a48b7a7 100644
--- a/tests/lua-factory/sources/test_lua_metrolyrics.c
+++ b/tests/lua-factory/sources/test_lua_metrolyrics.c
@@ -106,8 +106,17 @@ test_resolve_metrolyrics (void)
     g_clear_pointer (&file, g_object_unref);
 
     if (g_ascii_strncasecmp (lyrics, data, size - 1) != 0) {
-      g_warning ("Lyrics of '%s' from '%s' changed. Check if metrolyrics.com changed",
-                  audios[i].title, audios[i].artist);
+      char *filename;
+      int fd;
+
+      fd = g_file_open_tmp ("metrolyrics-test-XXXXXX", &filename, NULL);
+      g_assert (fd > 0);
+      g_assert (g_file_set_contents (filename, lyrics, -1, NULL));
+      close (fd);
+
+      g_warning ("Lyrics of '%s' from '%s' changed. Check if metrolyrics.com changed. New lyrics saved in 
'%s'",
+                  audios[i].title, audios[i].artist, filename);
+      g_free (filename);
     }
     g_clear_pointer (&lyrics, g_free);
     g_clear_pointer (&data, g_free);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]