summaryrefslogtreecommitdiffstats
path: root/tdeabc
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2016-12-17 15:56:05 +0300
committerSlávek Banko <slavek.banko@axis.cz>2017-01-29 02:48:49 +0100
commit5465c1f100334860202f6f3408ccd43df8d3002c (patch)
tree69a06fb3e8c92b10d5a90c5243e6f48a564afdef /tdeabc
parent1341c26a7a60d5260da37a278a79148a09ef21e9 (diff)
downloadtdelibs-5465c1f100334860202f6f3408ccd43df8d3002c.tar.gz
tdelibs-5465c1f100334860202f6f3408ccd43df8d3002c.zip
tdeabc: update the tests for vcardparser to run them in a new way
Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit 64b2c5281731cc114ea225a2fd37db35be03ecb4)
Diffstat (limited to 'tdeabc')
-rw-r--r--tdeabc/vcardparser/CMakeLists.txt53
-rw-r--r--tdeabc/vcardparser/testread2.cpp5
2 files changed, 18 insertions, 40 deletions
diff --git a/tdeabc/vcardparser/CMakeLists.txt b/tdeabc/vcardparser/CMakeLists.txt
index b23a23ffb..e141d1f47 100644
--- a/tdeabc/vcardparser/CMakeLists.txt
+++ b/tdeabc/vcardparser/CMakeLists.txt
@@ -2,6 +2,8 @@
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
+# (C) 2016 Alexander Golubev
+# fatzer2 (AT) gmail.com
#
# Improvements and feedback are welcome
#
@@ -60,56 +62,27 @@ tde_add_library( ${target} STATIC_PIC
##### test programs ##############################
-tde_add_executable( testread
- SOURCES testread.cpp AUTOMOC
- LINK ${TDEABC_TESTS_LINK}
-)
+tde_add_check_executable( testread AUTOMOC LINK ${TDEABC_TESTS_LINK} )
+tde_add_check_executable( testwrite AUTOMOC LINK ${TDEABC_TESTS_LINK} )
+tde_add_check_executable( testwrite2 AUTOMOC LINK ${TDEABC_TESTS_LINK} )
+tde_add_check_executable( testvcardformat AUTOMOC LINK ${TDEABC_TESTS_LINK} )
+tde_add_check_executable( testvcardformatimpl AUTOMOC LINK ${TDEABC_TESTS_LINK} )
-tde_add_executable( testread2
+tde_add_check_executable( testread2
SOURCES testread2.cpp testutils.cpp AUTOMOC
LINK ${TDEABC_TESTS_LINK}
)
-tde_add_executable( testwrite
- SOURCES testwrite.cpp AUTOMOC
- LINK ${TDEABC_TESTS_LINK}
-)
-
-tde_add_executable( testwrite2
- SOURCES testwrite2.cpp AUTOMOC
- LINK ${TDEABC_TESTS_LINK}
-)
-
-tde_add_executable( testvcardformat
- SOURCES testvcardformat.cpp AUTOMOC
- LINK ${TDEABC_TESTS_LINK}
-)
-
-tde_add_executable( testvcardformatimpl
- SOURCES testvcardformatimpl.cpp AUTOMOC
- LINK ${TDEABC_TESTS_LINK}
-)
-
-add_custom_target( vcardparser_tests ALL
- COMMENT "[VCardParser] Performing tests"
- COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/FAILED
- DEPENDS
- testvcardformatimpl testvcardformat testwrite2 testwrite testread2 testread
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-)
+add_test( NAME tdeabc/vcardparser/testread2 COMMAND testread2 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
+# testread tests
file( GLOB vcardparser_testfiles "tests/*.vcf" )
list( REMOVE_ITEM vcardparser_testfiles "${CMAKE_CURRENT_SOURCE_DIR}/tests/vcard5.vcf" )
list( SORT vcardparser_testfiles )
foreach(testfile ${vcardparser_testfiles})
- add_custom_command(
- TARGET vcardparser_tests
- COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/checkvcard.pl ${testfile}
+ get_filename_component(testfile_name "${testfile}" NAME_WE )
+ add_test( NAME tdeabc/vcardparser/testread-${testfile_name} COMMAND
+ perl ${CMAKE_CURRENT_SOURCE_DIR}/checkvcard.pl ${testfile}
)
endforeach(testfile)
-
-add_custom_command(
- TARGET vcardparser_tests
- COMMAND test ! -f ${CMAKE_CURRENT_BINARY_DIR}/FAILED
-)
diff --git a/tdeabc/vcardparser/testread2.cpp b/tdeabc/vcardparser/testread2.cpp
index 8bc7c8863..153530da0 100644
--- a/tdeabc/vcardparser/testread2.cpp
+++ b/tdeabc/vcardparser/testread2.cpp
@@ -8,6 +8,7 @@ using namespace TDEABC;
int
main()
{
+ int rc=0;
Addressee::List l = vCardsAsAddresseeList();
TQString vcards = vCardsAsText();
@@ -17,6 +18,7 @@ main()
if ( l.size() != parsed.size() ) {
kdDebug()<<"\tSize - FAILED : "<<l.size()<<" vs. parsed "<<parsed.size()<<endl;
+ rc=1;
} else {
kdDebug()<<"\tSize - PASSED"<<endl;
}
@@ -39,6 +41,9 @@ main()
kdDebug()<<">>>>>>>Addressee from file<<<<<<<<"<<endl;
(*itr2).dump();
//kdDebug()<<"\t\t"<< (*itr1).fullEmail() << " VS. " << (*itr2).fullEmail()<<endl;
+ rc=1;
}
}
+
+ return rc;
}