gtest.h 1022 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <library/cpp/testing/gtest/matchers.h>
  3. #include <library/cpp/testing/gtest_extensions/gtest_extensions.h>
  4. #include <gtest/gtest.h>
  5. #include <gmock/gmock.h>
  6. #include <optional>
  7. #include <string_view>
  8. /**
  9. * Bridge between GTest framework and Arcadia CI.
  10. */
  11. namespace NGTest {
  12. /**
  13. * Get custom test parameter.
  14. *
  15. * You can pass custom parameters to your test using the `--test-param` flag:
  16. *
  17. * ```
  18. * $ ya make -t --test-param NAME=VALUE
  19. * ```
  20. *
  21. * You can later access these parameters from tests using this function:
  22. *
  23. * ```
  24. * TEST(Suite, Name) {
  25. * EXPECT_EQ(GetTestParam("NAME").value_or("NOT_SET"), "VALUE");
  26. * }
  27. * ```
  28. *
  29. * @param name name of the parameter.
  30. * @return value of the parameter, as passed to the program arguments,
  31. * or nothing, if parameter not found.
  32. */
  33. std::optional<std::string_view> GetTestParam(std::string_view name);
  34. }