2022-05-23 17:24:55 +00:00
|
|
|
// normalize-stderr-test "note.*" -> "note: os-specific message"
|
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
extern crate rustc_macros;
|
|
|
|
use rustc_macros::fluent_messages;
|
|
|
|
|
|
|
|
/// Copy of the relevant `DiagnosticMessage` variant constructed by `fluent_messages` as it
|
|
|
|
/// expects `crate::DiagnosticMessage` to exist.
|
|
|
|
pub enum DiagnosticMessage {
|
|
|
|
FluentIdentifier(std::borrow::Cow<'static, str>, Option<std::borrow::Cow<'static, str>>),
|
|
|
|
}
|
|
|
|
|
2022-05-24 14:09:47 +00:00
|
|
|
/// Copy of the relevant `SubdiagnosticMessage` variant constructed by `fluent_messages` as it
|
|
|
|
/// expects `crate::SubdiagnosticMessage` to exist.
|
|
|
|
pub enum SubdiagnosticMessage {
|
|
|
|
FluentAttr(std::borrow::Cow<'static, str>),
|
|
|
|
}
|
|
|
|
|
2022-05-23 17:24:55 +00:00
|
|
|
mod missing_absolute {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
missing_absolute => "/definitely_does_not_exist.ftl",
|
|
|
|
//~^ ERROR could not open Fluent resource
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_relative {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
missing_relative => "../definitely_does_not_exist.ftl",
|
|
|
|
//~^ ERROR could not open Fluent resource
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_message {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
missing_message => "./missing-message.ftl",
|
|
|
|
//~^ ERROR could not parse Fluent resource
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod duplicate {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
2022-10-22 09:08:09 +00:00
|
|
|
//~^ ERROR the name `a_b_key` is defined multiple times
|
2022-05-23 17:24:55 +00:00
|
|
|
a => "./duplicate-a.ftl",
|
2022-08-17 11:05:13 +00:00
|
|
|
a_b => "./duplicate-a-b.ftl",
|
|
|
|
//~^ ERROR overrides existing message: `a_b_key`
|
2022-05-23 17:24:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:31:31 +00:00
|
|
|
mod slug_with_hyphens {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
slug_with_hyphens => "./slug-with-hyphens.ftl",
|
2022-08-17 11:05:13 +00:00
|
|
|
//~^ ERROR name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
|
2022-08-10 09:31:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod label_with_hyphens {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
label_with_hyphens => "./label-with-hyphens.ftl",
|
|
|
|
//~^ ERROR attribute `label-has-hyphens` contains a '-' character
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-23 17:24:55 +00:00
|
|
|
mod valid {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
valid => "./valid.ftl",
|
|
|
|
}
|
|
|
|
|
2022-10-22 09:08:09 +00:00
|
|
|
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid_key};
|
2022-08-17 11:05:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_crate_name {
|
|
|
|
use super::fluent_messages;
|
|
|
|
|
|
|
|
fluent_messages! {
|
|
|
|
test_crate => "./missing-crate-name.ftl",
|
|
|
|
//~^ ERROR name `test-crate_foo` contains a '-' character
|
|
|
|
//~| ERROR name `with-hyphens` contains a '-' character
|
|
|
|
//~| ERROR name `with-hyphens` does not start with the crate name
|
|
|
|
}
|
|
|
|
|
2022-10-22 09:08:09 +00:00
|
|
|
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate_foo, with_hyphens};
|
2022-05-23 17:24:55 +00:00
|
|
|
}
|