prompt_test.cxx 687 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // prompt_test.cxx
  3. // cli-test
  4. //
  5. // Created by Sam Jaffe on 10/10/20.
  6. // Copyright © 2020 Sam Jaffe. All rights reserved.
  7. //
  8. #include "cli/prompt.h"
  9. #include <gmock/gmock.h>
  10. #include <gtest/gtest.h>
  11. #if XCODE_UNIT_TEST
  12. // This is a hack to allow XCode to properly display failures when running
  13. // unit tests.
  14. #undef EXPECT_THAT
  15. #define EXPECT_THAT ASSERT_THAT
  16. #undef EXPECT_TRUE
  17. #define EXPECT_TRUE ASSERT_TRUE
  18. #undef EXPECT_FALSE
  19. #define EXPECT_FALSE ASSERT_FALSE
  20. #endif
  21. TEST(PromptTest, WillOutputEverythingInMessageWithNoSpaces) {
  22. std::stringstream out;
  23. auto msg = cli::make_message("Example", 1, true);
  24. msg->print(out);
  25. EXPECT_THAT(out.str(), "Example1true");
  26. }