UTIL: attempt to fix the newline problem with gitattributes

Martin Gerhardy 2020-01-07 22:25:49 +01:00
parent b75c029c0b
commit 4017049e87
2 changed files with 3 additions and 8 deletions

1
data/testutil/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.h text eol=lf

View File

@ -6,12 +6,6 @@
#include "util/IncludeUtil.h"
#include <SDL_platform.h>
#ifdef __WINDOWS__
#define NEWLINE "\r\n"
#else
#define NEWLINE "\n"
#endif
class IncludeUtilTest : public core::AbstractTest {
};
@ -23,9 +17,9 @@ TEST_F(IncludeUtilTest, testInclude) {
std::pair<std::string, bool> retIncludes = util::handleIncludes(src, includeDirs, &includedFiles);
EXPECT_TRUE(retIncludes.second);
EXPECT_EQ(2u, includedFiles.size());
EXPECT_EQ("#error \"one\"" NEWLINE "#include \"two.h\"" NEWLINE NEWLINE "#error \"two\"" NEWLINE NEWLINE, retIncludes.first);
EXPECT_EQ("#error \"one\"\n#include \"two.h\"\n\n#error \"two\"\n\n", retIncludes.first);
retIncludes = util::handleIncludes(retIncludes.first, includeDirs, &includedFiles);
EXPECT_TRUE(retIncludes.second);
EXPECT_EQ(3u, includedFiles.size());
EXPECT_EQ("#error \"one\"" NEWLINE "#error \"two\"" NEWLINE NEWLINE NEWLINE "#error \"two\"" NEWLINE NEWLINE, retIncludes.first);
EXPECT_EQ("#error \"one\"\n#error \"two\"\n\n\n#error \"two\"\n\n", retIncludes.first);
}