TestExtraLabels-check.cmake 1.1 KB

12345678910111213141516171819202122232425
  1. file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag)
  2. string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}")
  3. file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents)
  4. # Check labels.
  5. STRING(REGEX MATCHALL [[<Label>label1</Label>]] matches "${_test_contents}")
  6. list(LENGTH matches n_matches)
  7. if(NOT n_matches EQUAL 1)
  8. string(APPEND RunCMake_TEST_FAILED "expected 1 match for label1, found ${n_matches}")
  9. endif()
  10. STRING(REGEX MATCHALL [[<Label>label2</Label>]] matches "${_test_contents}")
  11. list(LENGTH matches n_matches)
  12. if(NOT n_matches EQUAL 1)
  13. string(APPEND RunCMake_TEST_FAILED "expected 1 match for label2, found ${n_matches}")
  14. endif()
  15. STRING(REGEX MATCHALL [[<Label>label3</Label>]] matches "${_test_contents}")
  16. list(LENGTH matches n_matches)
  17. if(NOT n_matches EQUAL 1)
  18. string(APPEND RunCMake_TEST_FAILED "expected 1 match for label3, found ${n_matches}")
  19. endif()
  20. # Check test output.
  21. if(NOT _test_contents MATCHES "<Value>before\nafter\n</Value>")
  22. string(APPEND RunCMake_TEST_FAILED "Could not find expected output in Test.xml")
  23. endif()