diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2022-08-10 08:20:58 +0300 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2022-08-15 23:18:18 +0300 |
| commit | 11389247c532bf3564ea89ea3264f707d1340dd2 (patch) | |
| tree | fc686b483a9c75785af2b82fa06b6b5f54b4eeed /lib/utils/mu-utils.cc | |
| parent | 3ba2c4ea08b5f9631556718c1f9b59d5213ea15b (diff) | |
tests: update test helpers and users
Move test-mu-common to mu-test-utils. Use mu_test_init as a wrapper for
g_test_init. Update users.
Diffstat (limited to 'lib/utils/mu-utils.cc')
| -rw-r--r-- | lib/utils/mu-utils.cc | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/utils/mu-utils.cc b/lib/utils/mu-utils.cc index 0f9e6e3..f32eed7 100644 --- a/lib/utils/mu-utils.cc +++ b/lib/utils/mu-utils.cc @@ -585,7 +585,6 @@ Mu::from_lexnum(const std::string& str) } - std::string Mu::canonicalize_filename(const std::string& path, const std::string& relative_to) { @@ -602,50 +601,6 @@ Mu::canonicalize_filename(const std::string& path, const std::string& relative_t } -void -Mu::allow_warnings() -{ - g_test_log_set_fatal_handler( - [](const char*, GLogLevelFlags, const char*, gpointer) { return FALSE; }, - {}); -} - - - -Mu::TempDir::TempDir(bool autodelete): autodelete_{autodelete} -{ - GError *err{}; - gchar *tmpdir = g_dir_make_tmp("mu-tmp-XXXXXX", &err); - if (!tmpdir) - throw Mu::Error(Error::Code::File, &err, - "failed to create temporary directory"); - - path_ = tmpdir; - g_free(tmpdir); - - g_debug("created '%s'", path_.c_str()); -} - -Mu::TempDir::~TempDir() -{ - if (::access(path_.c_str(), F_OK) != 0) - return; /* nothing to do */ - - if (!autodelete_) { - g_debug("_not_ deleting %s", path_.c_str()); - return; - } - - /* ugly */ - GError *err{}; - const auto cmd{format("/bin/rm -rf '%s'", path_.c_str())}; - if (!g_spawn_command_line_sync(cmd.c_str(), NULL, NULL, NULL, &err)) { - g_warning("error: %s\n", err ? err->message : "?"); - g_clear_error(&err); - } else - g_debug("removed '%s'", path_.c_str()); -} - bool Mu::locale_workaround() try { |
