@@ -1984,6 +1984,30 @@ TEST(Diagnostics, Tags) {
1984
1984
withTag (DiagnosticTag::Deprecated)))));
1985
1985
}
1986
1986
1987
+ TEST (Diagnostics, TidyDiagsArentAffectedFromWerror) {
1988
+ TestTU TU;
1989
+ TU.ExtraArgs = {" -Werror" };
1990
+ Annotations Test (R"cpp( $typedef[[typedef int INT]]; // error-ok)cpp" );
1991
+ TU.Code = Test.code ().str ();
1992
+ TU.ClangTidyProvider = addTidyChecks (" modernize-use-using" );
1993
+ EXPECT_THAT (
1994
+ TU.build ().getDiagnostics (),
1995
+ ifTidyChecks (UnorderedElementsAre (
1996
+ AllOf (Diag (Test.range (" typedef" ), " use 'using' instead of 'typedef'" ),
1997
+ // Make sure severity for clang-tidy finding isn't bumped to
1998
+ // error due to Werror in compile flags.
1999
+ diagSeverity (DiagnosticsEngine::Warning)))));
2000
+
2001
+ TU.ClangTidyProvider =
2002
+ addTidyChecks (" modernize-use-using" , /* WarningsAsErrors=*/ " modernize-*" );
2003
+ EXPECT_THAT (
2004
+ TU.build ().getDiagnostics (),
2005
+ ifTidyChecks (UnorderedElementsAre (
2006
+ AllOf (Diag (Test.range (" typedef" ), " use 'using' instead of 'typedef'" ),
2007
+ // Unless bumped explicitly with WarnAsError.
2008
+ diagSeverity (DiagnosticsEngine::Error)))));
2009
+ }
2010
+
1987
2011
TEST (Diagnostics, DeprecatedDiagsAreHints) {
1988
2012
ClangdDiagnosticOptions Opts;
1989
2013
std::optional<clangd::Diagnostic> Diag;
0 commit comments