diff options
| author | Martin Probst <martin@probst.io> | 2016-09-18 17:21:52 +0000 |
|---|---|---|
| committer | Martin Probst <martin@probst.io> | 2016-09-18 17:21:52 +0000 |
| commit | b9316ff84979e53260c1c3bcbfa0359a891ad1a9 (patch) | |
| tree | 049f355dfda8add7ec28ec57a603fea2e8c6d778 /clang/unittests/Format/FormatTestJS.cpp | |
| parent | 3f307518f8bea834e7ba0fb522e990063d09cfb3 (diff) | |
| download | bcm5719-llvm-b9316ff84979e53260c1c3bcbfa0359a891ad1a9.tar.gz bcm5719-llvm-b9316ff84979e53260c1c3bcbfa0359a891ad1a9.zip | |
clang-format: [JS] ASI insertion after boolean literals.
Summary:
Before when a semicolon was missing after a boolean literal:
a = true
return 1;
clang-format would parse this as one line and format as:
a = true return 1;
It turns out that C++ does not consider `true` and `false` to be literals, we
have to check for that explicitly.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24574
llvm-svn: 281856
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 9ccb75b6296..dd95462daf4 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -774,6 +774,18 @@ TEST_F(FormatTestJS, AutomaticSemicolonInsertionHeuristic) { "String"); verifyFormat("function f(@Foo bar) {}", "function f(@Foo\n" " bar) {}"); + verifyFormat("a = true\n" + "return 1", + "a = true\n" + " return 1"); + verifyFormat("a = 's'\n" + "return 1", + "a = 's'\n" + " return 1"); + verifyFormat("a = null\n" + "return 1", + "a = null\n" + " return 1"); } TEST_F(FormatTestJS, ClosureStyleCasts) { |

