mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-20 16:06:50 +00:00
Add diagnostic coverage, remove possibly-unreachable unary op diagnostic (#4519)
I'm working to make sure remaining diagnostics have coverage, at least the ones I'd previously added a TODO for. Note in particular that I couldn't figure out a repro for UnaryOperatorRequiresWhitespace; if you have one, I can add a test, but otherwise maybe it's actually unreachable due to being diagnosed through infix logic (or, maybe this'll let fuzzing tell me an example).
This commit is contained in:
1 parent
3ba4997855
commit
fa95892a37
10 files changed
+478
-43
No files matched your search
@@ -1119,6 +1119,22 @@ TEST_F(LexerTest, DiagnosticInvalidDigit) {
|
||||
compile_helper_.GetTokenizedBuffer("0x123abc", &consumer);
|
||||
}
|
||||
|
||||
TEST_F(LexerTest, DiagnosticCR) {
|
||||
Testing::MockDiagnosticConsumer consumer;
|
||||
EXPECT_CALL(consumer, HandleDiagnostic(IsSingleDiagnostic(
|
||||
DiagnosticKind::UnsupportedCRLineEnding,
|
||||
DiagnosticLevel::Error, 1, 1, _)));
|
||||
compile_helper_.GetTokenizedBuffer("\r", &consumer);
|
||||
}
|
||||
|
||||
TEST_F(LexerTest, DiagnosticLFCR) {
|
||||
Testing::MockDiagnosticConsumer consumer;
|
||||
EXPECT_CALL(consumer, HandleDiagnostic(IsSingleDiagnostic(
|
||||
DiagnosticKind::UnsupportedLFCRLineEnding,
|
||||
DiagnosticLevel::Error, 2, 1, _)));
|
||||
compile_helper_.GetTokenizedBuffer("\n\r", &consumer);
|
||||
}
|
||||
|
||||
TEST_F(LexerTest, DiagnosticMissingTerminator) {
|
||||
Testing::MockDiagnosticConsumer consumer;
|
||||
EXPECT_CALL(consumer, HandleDiagnostic(IsSingleDiagnostic(
|
||||
|
||||
Reference in new issue
Block a user