From 1ad081967284c99a5f86ff7b7e84416c0a601281 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 17 Jan 2012 18:28:43 +0000 Subject: Remove use of wordexp. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3957 a436a847-0d15-0410-975c-d299462d15a1 --- test/lilv_test.c | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'test/lilv_test.c') diff --git a/test/lilv_test.c b/test/lilv_test.c index c5f2b93..c8c565a 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -17,15 +17,16 @@ #define _POSIX_C_SOURCE 200112L /* for setenv */ -#include -#include -#include -#include #include -#include -#include +#include #include +#include #include +#include +#include +#include +#include +#include #include "lilv/lilv.h" #include "../src/lilv_internal.h" @@ -381,6 +382,40 @@ test_discovery(void) /*****************************************************************************/ +int +test_lv2_path(void) +{ + char* orig_lv2_path = lilv_strdup(getenv("LV2_PATH")); + + setenv("LV2_PATH", "~/.lv2:/usr/local/lib/lv2:/usr/lib/lv2", 1); + + LilvWorld* world = lilv_world_new(); + lilv_world_load_all(world); + + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const size_t n_plugins = lilv_plugins_size(plugins); + + lilv_world_free(world); + + setenv("LV2_PATH", "$HOME/.lv2:/usr/local/lib/lv2:/usr/lib/lv2", 1); + world = lilv_world_new(); + lilv_world_load_all(world); + plugins = lilv_world_get_all_plugins(world); + TEST_ASSERT(lilv_plugins_size(plugins) == n_plugins); + lilv_world_free(world); + + if (orig_lv2_path) { + setenv("LV2_PATH", orig_lv2_path, 1); + } else { + unsetenv("LV2_PATH"); + } + free(orig_lv2_path); + + return 1; +} + +/*****************************************************************************/ + int test_verify(void) { @@ -1398,6 +1433,7 @@ static struct TestCase tests[] = { TEST_CASE(verify), TEST_CASE(no_verify), TEST_CASE(discovery), + TEST_CASE(lv2_path), TEST_CASE(classes), TEST_CASE(plugin), TEST_CASE(port), -- cgit v1.2.1