RegexUtilsTest.cpp 837 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-18
  6. * Changed: 2022-11-09
  7. *
  8. * */
  9. #include <gtest/gtest.h>
  10. #include <ls_std/ls_std_core.hpp>
  11. using namespace ls::std::core;
  12. using namespace ::std;
  13. namespace
  14. {
  15. class RegexUtilsTest : public ::testing::Test
  16. {
  17. protected:
  18. RegexUtilsTest() = default;
  19. ~RegexUtilsTest() override = default;
  20. void SetUp() override
  21. {}
  22. void TearDown() override
  23. {}
  24. };
  25. TEST_F(RegexUtilsTest, escapeString)
  26. {
  27. string escapedString = RegexUtils::escapeString("Hello?!");
  28. ASSERT_STREQ(R"(Hello\?!)", escapedString.c_str());
  29. escapedString = RegexUtils::escapeString(R"(\)");
  30. ASSERT_STREQ(R"(\\)", escapedString.c_str());
  31. }
  32. }