clang-format: [JS] Ensure that formatting actually takes place in tests.

And fix formatting issue discovered by that :-).

llvm-svn: 239530
This commit is contained in:
Daniel Jasper 2015-06-11 13:29:20 +00:00
parent b6b58b3152
commit 56691b8cb9
2 changed files with 5 additions and 2 deletions

View File

@ -558,7 +558,7 @@ private:
break;
case tok::question:
if (Style.Language == FormatStyle::LK_JavaScript && Tok->Next &&
Tok->Next->isOneOf(tok::semi, tok::colon, tok::r_paren,
Tok->Next->isOneOf(tok::semi, tok::comma, tok::colon, tok::r_paren,
tok::r_brace)) {
// Question marks before semicolons, colons, etc. indicate optional
// types (fields, parameters), e.g.

View File

@ -24,7 +24,10 @@ protected:
DEBUG(llvm::errs() << "---\n");
DEBUG(llvm::errs() << Code << "\n\n");
std::vector<tooling::Range> Ranges(1, tooling::Range(Offset, Length));
tooling::Replacements Replaces = reformat(Style, Code, Ranges);
bool IncompleteFormat = false;
tooling::Replacements Replaces =
reformat(Style, Code, Ranges, "<stdin>", &IncompleteFormat);
EXPECT_FALSE(IncompleteFormat);
std::string Result = applyAllReplacements(Code, Replaces);
EXPECT_NE("", Result);
DEBUG(llvm::errs() << "\n" << Result << "\n\n");