mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:41:06 +01: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:
@@ -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