Currently, a lot of our build variables that are defined at configuration time, are spread out across the code base, often declared as `extern` which can break when moving around sections of the code across files. This commit introduces a "Config" namespace which basically maps to the definitions in `config.h`, but allows us to properly access them too from the Vala source code. By doing so, it helps us to more explicitly see where we rely on a build variable from this file (which should be obvious from the `Config' namespace). To make it ourselves a bit easier in Meson too, we can declare an internal dependency, which helps ensure that we pull in the dependency where needed.
49 lines
1.3 KiB
Vala
49 lines
1.3 KiB
Vala
/*
|
|
* Copyright 2019 Michael Gratton <mike@vee.net>
|
|
*
|
|
* This software is licensed under the GNU Lesser General Public License
|
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
|
*/
|
|
|
|
|
|
class Application.ClientTest : TestCase {
|
|
|
|
|
|
private Client? test_article = null;
|
|
|
|
|
|
public ClientTest() {
|
|
base("Application.ClientTest");
|
|
add_test("paths_when_installed", paths_when_installed);
|
|
}
|
|
|
|
public override void set_up() {
|
|
this.test_article = new Client();
|
|
}
|
|
|
|
public override void tear_down() {
|
|
this.test_article = null;
|
|
}
|
|
|
|
public void paths_when_installed() throws GLib.Error {
|
|
string[] args = new string[] {
|
|
Config.INSTALL_PREFIX + "/bin/geary",
|
|
// Specify this so the app doesn't actually attempt
|
|
// to start up
|
|
"-v"
|
|
};
|
|
unowned string[] unowned_args = args;
|
|
int status;
|
|
this.test_article.local_command_line(ref unowned_args, out status);
|
|
|
|
assert_equal(
|
|
this.test_article.get_resource_directory().get_path(),
|
|
Config.INSTALL_PREFIX + "/share/geary"
|
|
);
|
|
assert_equal(
|
|
this.test_article.get_desktop_directory().get_path(),
|
|
Config.INSTALL_PREFIX + "/share/applications"
|
|
);
|
|
}
|
|
|
|
}
|