summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-05-20 11:14:57 +0000
committerDaniel Jasper <djasper@google.com>2014-05-20 11:14:57 +0000
commit069e5f485818eb127ae1944b6759b29dbce3437a (patch)
tree570cb9836e6197258c6b4b0b89dda0fe9938e0ac /clang/unittests/Format/FormatTestJS.cpp
parente7fa2314af4b04c54925f2c7b5f310a69183c106 (diff)
downloadbcm5719-llvm-069e5f485818eb127ae1944b6759b29dbce3437a.tar.gz
bcm5719-llvm-069e5f485818eb127ae1944b6759b29dbce3437a.zip
clang-format: [JS] Understand top-level function literals properly.
llvm-svn: 209205
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index f38bf895f21..657f10874e0 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -31,7 +31,9 @@ protected:
return Result;
}
- static std::string format(llvm::StringRef Code, const FormatStyle &Style) {
+ static std::string format(
+ llvm::StringRef Code,
+ const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_JavaScript)) {
return format(Code, 0, Code.size(), Style);
}
@@ -116,6 +118,8 @@ TEST_F(FormatTestJS, Closures) {
" style: {direction: ''}\n"
" }\n"
"};");
+ EXPECT_EQ("abc = xyz ? function() { return 1; } : function() { return -1; };",
+ format("abc=xyz?function(){return 1;}:function(){return -1;};"));
}
TEST_F(FormatTestJS, ReturnStatements) {
OpenPOWER on IntegriCloud