Skip to content

Commit

Permalink
Add test for invalid variables
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Jun 23, 2023
1 parent 220bb61 commit 8969d97
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/ui-fulldeps/session-diagnostic/example.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ no_crate_example = this is an example message used in testing
.help = with a help
.suggestion = with a suggestion
.label = with a label
no_crate_bad_reference = {$r} does not exist
21 changes: 21 additions & 0 deletions tests/ui-fulldeps/session-diagnostic/invalid-variable.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// run-fail
// compile-flags: --test
// test that messages referencing non-existent fields cause test failures

#![feature(rustc_private)]
#![crate_type = "lib"]

extern crate rustc_driver;
extern crate rustc_fluent_macro;
extern crate rustc_macros;
extern crate rustc_errors;
use rustc_fluent_macro::fluent_messages;
use rustc_macros::Diagnostic;
use rustc_errors::{SubdiagnosticMessage, DiagnosticMessage};
extern crate rustc_session;

fluent_messages! { "./example.ftl" }

#[derive(Diagnostic)]
#[diag(no_crate_bad_reference)]
struct BadRef;

0 comments on commit 8969d97

Please sign in to comment.