2023-03-30 20:48:35 -05:00
|
|
|
//@ normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message"
|
2022-05-23 12:24:55 -05:00
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
#![crate_type = "lib"]
|
2023-11-21 16:22:39 -06:00
|
|
|
extern crate rustc_errors;
|
2023-04-16 07:33:00 -05:00
|
|
|
extern crate rustc_fluent_macro;
|
2022-05-23 12:24:55 -05:00
|
|
|
|
2024-02-28 18:58:51 -06:00
|
|
|
/// Copy of the relevant `DiagMessage` variant constructed by `fluent_messages` as it
|
|
|
|
/// expects `crate::DiagMessage` to exist.
|
|
|
|
pub enum DiagMessage {
|
2022-05-23 12:24:55 -05:00
|
|
|
FluentIdentifier(std::borrow::Cow<'static, str>, Option<std::borrow::Cow<'static, str>>),
|
|
|
|
}
|
|
|
|
|
2024-02-28 21:53:44 -06:00
|
|
|
/// Copy of the relevant `SubdiagMessage` variant constructed by `fluent_messages` as it
|
|
|
|
/// expects `crate::SubdiagMessage` to exist.
|
|
|
|
pub enum SubdiagMessage {
|
2022-05-24 09:09:47 -05:00
|
|
|
FluentAttr(std::borrow::Cow<'static, str>),
|
|
|
|
}
|
|
|
|
|
2022-05-23 12:24:55 -05:00
|
|
|
mod missing_absolute {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "/definitely_does_not_exist.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR could not open Fluent resource
|
2022-05-23 12:24:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_relative {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "../definitely_does_not_exist.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR could not open Fluent resource
|
2022-05-23 12:24:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_message {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./missing-message.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR could not parse Fluent resource
|
2022-05-23 12:24:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod duplicate {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./duplicate.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR overrides existing message: `no_crate_a_b_key`
|
2022-05-23 12:24:55 -05:00
|
|
|
}
|
|
|
|
|
2022-08-10 04:31:31 -05:00
|
|
|
mod slug_with_hyphens {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./slug-with-hyphens.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR name `no_crate_this-slug-has-hyphens` contains a '-' character
|
2022-08-10 04:31:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod label_with_hyphens {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./label-with-hyphens.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR attribute `label-has-hyphens` contains a '-' character
|
2022-08-10 04:31:31 -05:00
|
|
|
}
|
|
|
|
|
2022-05-23 12:24:55 -05:00
|
|
|
mod valid {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./valid.ftl" }
|
2022-05-23 12:24:55 -05:00
|
|
|
|
2022-10-13 04:13:02 -05:00
|
|
|
mod test_generated {
|
|
|
|
use super::{fluent_generated::no_crate_key, DEFAULT_LOCALE_RESOURCE};
|
|
|
|
}
|
2022-08-17 06:05:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_crate_name {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./missing-crate-name.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR name `no-crate_foo` contains a '-' character
|
|
|
|
//~| ERROR name `with-hyphens` contains a '-' character
|
|
|
|
//~| ERROR name `with-hyphens` does not start with the crate name
|
2022-08-17 06:05:13 -05:00
|
|
|
|
2022-10-13 04:13:02 -05:00
|
|
|
mod test_generated {
|
|
|
|
use super::{
|
|
|
|
fluent_generated::{no_crate_foo, with_hyphens},
|
|
|
|
DEFAULT_LOCALE_RESOURCE,
|
|
|
|
};
|
|
|
|
}
|
2022-05-23 12:24:55 -05:00
|
|
|
}
|
2023-01-19 17:48:08 -06:00
|
|
|
|
|
|
|
mod missing_message_ref {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./missing-message-ref.ftl" }
|
2022-10-13 04:13:02 -05:00
|
|
|
//~^ ERROR referenced message `message` does not exist
|
2023-01-19 17:48:08 -06:00
|
|
|
}
|
2023-03-29 10:00:48 -05:00
|
|
|
|
|
|
|
mod bad_escape {
|
2023-11-21 16:53:07 -06:00
|
|
|
rustc_fluent_macro::fluent_messages! { "./invalid-escape.ftl" }
|
2023-03-29 10:00:48 -05:00
|
|
|
//~^ ERROR invalid escape `\n`
|
|
|
|
//~| ERROR invalid escape `\"`
|
|
|
|
//~| ERROR invalid escape `\'`
|
|
|
|
}
|