[price-quotes] Make wiggle test conditional on F::Q being installed.

This commit is contained in:
John Ralls 2022-09-01 15:46:47 -07:00
parent 784aca5a4c
commit 4dd3922871
3 changed files with 14 additions and 0 deletions

View File

@ -512,6 +512,14 @@ if (NOT PERL_FOUND)
message(SEND_ERROR "Perl executable not found. Please set PERL_EXECUTABLE.")
endif()
execute_process(COMMAND
${PERL_EXECUTABLE} -MFinance::Quote -e ""
ERROR_QUIET
RESULT_VARIABLE have_f_q)
if (${have_f_q} EQUAL 0)
set(HAVE_F_Q 1)
endif()
get_filename_component(PERL_DIR ${PERL_EXECUTABLE} DIRECTORY)
find_program(POD2MAN_EXECUTABLE pod2man HINTS ${PERL_DIR})

View File

@ -129,6 +129,9 @@
/* Define to 1 if you have the `pthread' library (-lpthread). */
#cmakedefine HAVE_LIBPTHREAD 1
/* Define to 1 if Finance::Quote is installed in perl. */
#cmakedefine HAVE_F_Q 1
/* System has libsecret 0.18 or better */
#cmakedefine HAVE_LIBSECRET 1

View File

@ -112,6 +112,8 @@ TEST_F(GncQuotesTest, quotable_commodities)
auto commodities{gnc_quotes_get_quotable_commodities(gnc_commodity_table_get_table(m_book))};
EXPECT_EQ(4u, commodities.size());
}
#ifdef HAVE_F_Q
TEST_F(GncQuotesTest, wiggle)
{
GncQuotes quotes;
@ -119,3 +121,4 @@ TEST_F(GncQuotesTest, wiggle)
auto pricedb{gnc_pricedb_get_db(m_book)};
EXPECT_EQ(3u, gnc_pricedb_get_num_prices(pricedb));
}
#endif