summaryrefslogtreecommitdiffstats
path: root/Tests/GoogleTest/Test
diff options
context:
space:
mode:
authorDaniel Sim <dannie.sim@gmail.com>2024-03-11 09:04:12 (GMT)
committerDaniel Sim <dannie.sim@gmail.com>2024-03-11 22:04:31 (GMT)
commita0343abd59dee4d9cf99429dceabc9244cebd446 (patch)
tree2a1e77fb9f5a33a843df1e076601c12492c780d5 /Tests/GoogleTest/Test
parent2d61db8bf3d09e5dcaa8a3247784ec65dc49fe63 (diff)
downloadCMake-a0343abd59dee4d9cf99429dceabc9244cebd446.zip
CMake-a0343abd59dee4d9cf99429dceabc9244cebd446.tar.gz
CMake-a0343abd59dee4d9cf99429dceabc9244cebd446.tar.bz2
GoogleTest: Add DEF_SOURCE_LINE property to gtest_add_tests
Diffstat (limited to 'Tests/GoogleTest/Test')
-rw-r--r--Tests/GoogleTest/Test/CMakeLists.txt22
1 files changed, 21 insertions, 1 deletions
diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt
index baf00d5..201c39e 100644
--- a/Tests/GoogleTest/Test/CMakeLists.txt
+++ b/Tests/GoogleTest/Test/CMakeLists.txt
@@ -81,10 +81,30 @@ gtest_add_tests(test_gtest3 "" AUTO)
if(NOT TEST GoogleTest.Foo)
message(FATAL_ERROR "Test case GoogleTest.Foo not defined")
endif()
+# Check if test has property DEF_SOURCE_LINE
+get_test_property(GoogleTest.Foo DEF_SOURCE_LINE testSourceLineFoo)
+if(NOT testSourceLineFoo)
+ message(FATAL_ERROR "Test GoogleTest.Foo should have DEF_SOURCE_LINE property")
+endif()
+# If check property ends with correct value
+string(FIND "${testSourceLineFoo}" "main3.cxx:3" testSourceLineFooFound)
+if(${testSourceLineFooFound} EQUAL -1)
+ message(FATAL_ERROR "Test GoogleTest.Foo should have DEF_SOURCE_LINE property with value main3.cxx:3")
+endif()
+
if(NOT TEST GoogleTest.Bar)
message(FATAL_ERROR "Test case GoogleTest.Bar not defined")
endif()
-
+# Check if test has property DEF_SOURCE_LINE
+get_test_property(GoogleTest.Bar DEF_SOURCE_LINE testSourceLineBar)
+if(NOT testSourceLineBar)
+ message(FATAL_ERROR "Test GoogleTest.Bar should have DEF_SOURCE_LINE property")
+endif()
+# If check property ends with correct value
+string(FIND "${testSourceLineBar}" "main3.cxx:8" testSourceLineBarFound)
+if(${testSourceLineBarFound} EQUAL -1)
+ message(FATAL_ERROR "Test GoogleTest.Bar should have DEF_SOURCE_LINE property with value main3.cxx:8")
+endif()
# Non-keyword form, explicitly specified sources. Allows a non-target to be
# given for the executable.