summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestJS.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2016-05-29 14:41:36 +0000
committerMartin Probst <martin@probst.io>2016-05-29 14:41:36 +0000
commit7ea9b6d7832c1b99a0da1b0d70e0e885ebe44ea3 (patch)
tree376be6e358e41b80e1e11b272192240ee040a80e /clang/unittests/Format/FormatTestJS.cpp
parent409697ecb962d025ae06b18885ea3aa59e48f343 (diff)
downloadbcm5719-llvm-7ea9b6d7832c1b99a0da1b0d70e0e885ebe44ea3.tar.gz
bcm5719-llvm-7ea9b6d7832c1b99a0da1b0d70e0e885ebe44ea3.zip
clang-format: [JS] Support shebang lines on the very first line.
Summary: Shebang lines (`#!/bin/blah`) can be used in JavaScript scripts to indicate they should be run using e.g. node. This change treats # lines on the first line as line comments. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D20632 llvm-svn: 271185
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 33fd065ce49..e956ae24424 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -1276,5 +1276,12 @@ TEST_F(FormatTestJS, RequoteStringsLeave) {
verifyFormat("var x = 'foo';", LeaveQuotes);
}
+TEST_F(FormatTestJS, SupportShebangLines) {
+ verifyFormat("#!/usr/bin/env node\n"
+ "var x = hello();",
+ "#!/usr/bin/env node\n"
+ "var x = hello();");
+}
+
} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud