Changeset View
Changeset View
Standalone View
Standalone View
clang/unittests/Format/FormatTest.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 23,820 Lines • ▼ Show 20 Lines | TEST_F(FormatTest, OperatorPassedAsAFunctionPtr) { | ||||
verifyFormat("foo(-42, operator, );", Style); | verifyFormat("foo(-42, operator, );", Style); | ||||
verifyFormat("foo(operator, , -42);", Style); | verifyFormat("foo(operator, , -42);", Style); | ||||
} | } | ||||
TEST_F(FormatTest, WhitespaceSensitiveMacros) { | TEST_F(FormatTest, WhitespaceSensitiveMacros) { | ||||
FormatStyle Style = getLLVMStyle(); | FormatStyle Style = getLLVMStyle(); | ||||
Style.WhitespaceSensitiveMacros.push_back("FOO"); | Style.WhitespaceSensitiveMacros.push_back("FOO"); | ||||
// Newlines are important here. | |||||
verifyFormat("FOO(1+2 )\n", Style); | |||||
verifyFormat("FOO(a:b:c)\n", Style); | |||||
// Don't use the helpers here, since 'mess up' will change the whitespace | // Don't use the helpers here, since 'mess up' will change the whitespace | ||||
// and these are all whitespace sensitive by definition | // and these are all whitespace sensitive by definition | ||||
EXPECT_EQ("FOO(String-ized&Messy+But(: :Still)=Intentional);", | EXPECT_EQ("FOO(String-ized&Messy+But(: :Still)=Intentional);", | ||||
format("FOO(String-ized&Messy+But(: :Still)=Intentional);", Style)); | format("FOO(String-ized&Messy+But(: :Still)=Intentional);", Style)); | ||||
EXPECT_EQ( | EXPECT_EQ( | ||||
"FOO(String-ized&Messy+But\\(: :Still)=Intentional);", | "FOO(String-ized&Messy+But\\(: :Still)=Intentional);", | ||||
format("FOO(String-ized&Messy+But\\(: :Still)=Intentional);", Style)); | format("FOO(String-ized&Messy+But\\(: :Still)=Intentional);", Style)); | ||||
EXPECT_EQ("FOO(String-ized&Messy+But,: :Still=Intentional);", | EXPECT_EQ("FOO(String-ized&Messy+But,: :Still=Intentional);", | ||||
▲ Show 20 Lines • Show All 2,622 Lines • Show Last 20 Lines |