Skip to content

Commit

Permalink
Fix tests for pre-otp-27 versions
Browse files Browse the repository at this point in the history
Summary: In previous versions of OTP, the EDoc stops at the first error, so no other diagnostics are reported. Therefore, tweak the test so it works correctly with both versions.

Reviewed By: alanz

Differential Revision: D66304142

fbshipit-source-id: 2cd469a3f17f0296fd1a835faa6a0b808cb0ce7c
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Nov 21, 2024
1 parent a9170fd commit 60d05a1
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions crates/ide/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@ pub fn spec_for_undefined_function_from_message(s: &str) -> Option<String> {
#[cfg(test)]
mod tests {
use elp_project_model::otp::otp_supported_by_eqwalizer;
use elp_project_model::otp::supports_eep59_doc_attributes;
use expect_test::expect;

use super::*;
Expand Down Expand Up @@ -2481,18 +2482,34 @@ baz(1)->4.
fn edoc_generic_diagnostics_suppressed() {
let config = DiagnosticsConfig::default()
.disable(DiagnosticCode::ErlangService("O0000".to_string()));
check_diagnostics_with_config(
config,
r#"
//- edoc
//- /src/a_mod.erl app:app_a
-module(a_mod).
-export([foo/0]).
% @docc
%%<^^^^^ warning: tag @docc not recognized.
foo() -> \~"foo".
"#,
);
if supports_eep59_doc_attributes() {
check_diagnostics_with_config(
config,
r#"
//- edoc
//- /src/a_mod.erl app:app_a
-module(a_mod).
-export([foo/0]).
% @docc
%%<^^^^^ warning: tag @docc not recognized.
foo() -> \~"foo".
"#,
);
} else {
// In previous versions of OTP, the EDoc stops at the first error, so no other diagnostics are reported
check_diagnostics_with_config(
config,
r#"
//- edoc
//- /src/a_mod.erl app:app_a
-module(a_mod).
-export([foo/0]).
% @docc
foo() -> \~"foo".
"#,
);
}
}
}

0 comments on commit 60d05a1

Please sign in to comment.