Caphyon / clang-format-editor

Clang-Format Editor is a tool that helps you find the best Clang-Format Style for your C++, C#, Java, JavaScript, and Objective-C code.
https://clangpowertools.com/clang-format-editor.html
Apache License 2.0
43 stars 7 forks source link

Configurator crash #28

Open espr14 opened 2 years ago

espr14 commented 2 years ago
  1. Insert this code into the Configurator.
  2. Turn on any option.
  3. Application crashes in few seconds.
#include "pch.h"
#include "CppUnitTest.h"
#include "../HelloWorldUnitTestCPP/HelloWorldUnitTestCPP.cpp"   // Update using your project name

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace HelloWorldTests
{
   TEST_CLASS(HelloWorldTests)
   {
   public:

      TEST_METHOD(TestMethod)
      {
         std::string expected = "Hello World!\n";

         std::stringstream buffer;
         std::streambuf* sbuf = std::cout.rdbuf(); // Save cout's buffer
         std::cout.rdbuf(buffer.rdbuf()); // Redirect cout to the stringstream buffer

         // Call main() in your test
         int result = main();

         // When finished, redirect cout to the original buffer 
         std::cout.rdbuf(sbuf);
         std::cout << "std original buffer: \n";
         std::cout << buffer.get();

         // Test
         Assert::AreEqual(expected, buffer.str());
      }
   };
}
consulion commented 1 year ago

for me it also crashes after analyzing for a while, no matter which .cpp or .h file i select. additionally, it shows a message box with a warning when starting up image

mariru27 commented 1 year ago

Hi @espr14,

A fix for this issue is available in Clang Format Editor v2023.4.2

Thank you for reporting this problem

Kind regards, Marina