Skip to content

Commit

Permalink
Add more test cases for untranslatable_diagnostic lint
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigorenkoPV committed Aug 10, 2024
1 parent 8291d68 commit 10ef666
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/ui-fulldeps/internal-lints/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,11 @@ pub fn skipped_because_of_annotation<'a>(dcx: DiagCtxtHandle<'a>) {
fn f(_x: impl Into<DiagMessage>, _y: impl Into<SubdiagMessage>) {}
fn g() {
f(crate::fluent_generated::no_crate_example, crate::fluent_generated::no_crate_example);
f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
//~^ ERROR diagnostics should be created using translatable messages
f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
//~^ ERROR diagnostics should be created using translatable messages
f("untranslatable diagnostic", "untranslatable diagnostic");
//~^ ERROR diagnostics should be created using translatable messages
//~^^ ERROR diagnostics should be created using translatable messages
}
28 changes: 27 additions & 1 deletion tests/ui-fulldeps/internal-lints/diagnostics.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,31 @@ error: diagnostics should be created using translatable messages
LL | let _diag = dcx.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^

error: aborting due to 6 previous errors
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:120:5
|
LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example);
| ^

error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:122:5
|
LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic");
| ^

error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:124:5
|
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
| ^

error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:124:5
|
LL | f("untranslatable diagnostic", "untranslatable diagnostic");
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 10 previous errors

0 comments on commit 10ef666

Please sign in to comment.