-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): improve message for diag assertion failures
Before: test/test-parse-typescript-class.cpp:86: Failure Value of: diagnostics Expected: Actual: 24-byte object <A8-6B 7F-6F 01-00 00-00 10-38 01-34 01-00 00-00 10-38 01-34 01-00 00-00>, whose element #0 doesn't match, whose .token (14-15) doesn't equal 13-14 After: test/test-parse-typescript-class.cpp:86: Failure Value of: diagnostics Expected: 1 diagnostic: { Diag_Unexpected_Token{.token = 13..14}, } Actual: 1 diagnostic: { Diag_Unexpected_Token, }, whose element #0 doesn't match, whose .token (14-15) doesn't equal 13-14
- Loading branch information
Showing
9 changed files
with
194 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2020 Matthew "strager" Glazar | ||
// See end of file for extended copyright information. | ||
|
||
#include <ostream> | ||
#include <quick-lint-js/diag/diag-list.h> | ||
|
||
namespace quick_lint_js { | ||
std::ostream& operator<<(std::ostream& out, const Diag_List& diags) { | ||
int diag_count = 0; | ||
diags.for_each([&](Diag_Type, const void*) -> void { diag_count += 1; }); | ||
out << diag_count << " " << (diag_count == 1 ? "diagnostic" : "diagnostics"); | ||
if (diag_count > 0) { | ||
out << ": {\n"; | ||
diags.for_each([&](Diag_Type type, const void*) -> void { | ||
out << " " << type << ",\n"; | ||
}); | ||
out << "}"; | ||
} | ||
return out; | ||
} | ||
|
||
} | ||
|
||
// quick-lint-js finds bugs in JavaScript programs. | ||
// Copyright (C) 2020 Matthew "strager" Glazar | ||
// | ||
// This file is part of quick-lint-js. | ||
// | ||
// quick-lint-js is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// quick-lint-js is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters