1 // normalize-stderr-test "could not open Fluent resource:.*" -> "could not open Fluent resource: os-specific message" 2 3 #![feature(rustc_private)] 4 #![crate_type = "lib"] 5 6 extern crate rustc_fluent_macro; 7 use rustc_fluent_macro::fluent_messages; 8 9 /// Copy of the relevant `DiagnosticMessage` variant constructed by `fluent_messages` as it 10 /// expects `crate::DiagnosticMessage` to exist. 11 pub enum DiagnosticMessage { 12 FluentIdentifier(std::borrow::Cow<'static, str>, Option<std::borrow::Cow<'static, str>>), 13 } 14 15 /// Copy of the relevant `SubdiagnosticMessage` variant constructed by `fluent_messages` as it 16 /// expects `crate::SubdiagnosticMessage` to exist. 17 pub enum SubdiagnosticMessage { 18 FluentAttr(std::borrow::Cow<'static, str>), 19 } 20 21 mod missing_absolute { 22 use super::fluent_messages; 23 24 fluent_messages! { "/definitely_does_not_exist.ftl" } 25 //~^ ERROR could not open Fluent resource 26 } 27 28 mod missing_relative { 29 use super::fluent_messages; 30 31 fluent_messages! { "../definitely_does_not_exist.ftl" } 32 //~^ ERROR could not open Fluent resource 33 } 34 35 mod missing_message { 36 use super::fluent_messages; 37 38 fluent_messages! { "./missing-message.ftl" } 39 //~^ ERROR could not parse Fluent resource 40 } 41 42 mod duplicate { 43 use super::fluent_messages; 44 45 fluent_messages! { "./duplicate.ftl" } 46 //~^ ERROR overrides existing message: `no_crate_a_b_key` 47 } 48 49 mod slug_with_hyphens { 50 use super::fluent_messages; 51 52 fluent_messages! { "./slug-with-hyphens.ftl" } 53 //~^ ERROR name `no_crate_this-slug-has-hyphens` contains a '-' character 54 } 55 56 mod label_with_hyphens { 57 use super::fluent_messages; 58 59 fluent_messages! { "./label-with-hyphens.ftl" } 60 //~^ ERROR attribute `label-has-hyphens` contains a '-' character 61 } 62 63 mod valid { 64 use super::fluent_messages; 65 66 fluent_messages! { "./valid.ftl" } 67 68 mod test_generated { 69 use super::{fluent_generated::no_crate_key, DEFAULT_LOCALE_RESOURCE}; 70 } 71 } 72 73 mod missing_crate_name { 74 use super::fluent_messages; 75 76 fluent_messages! { "./missing-crate-name.ftl" } 77 //~^ ERROR name `no-crate_foo` contains a '-' character 78 //~| ERROR name `with-hyphens` contains a '-' character 79 //~| ERROR name `with-hyphens` does not start with the crate name 80 81 mod test_generated { 82 use super::{ 83 fluent_generated::{no_crate_foo, with_hyphens}, 84 DEFAULT_LOCALE_RESOURCE, 85 }; 86 } 87 } 88 89 mod missing_message_ref { 90 use super::fluent_messages; 91 92 fluent_messages! { "./missing-message-ref.ftl" } 93 //~^ ERROR referenced message `message` does not exist 94 } 95 96 mod bad_escape { 97 use super::fluent_messages; 98 99 fluent_messages! { "./invalid-escape.ftl" } 100 //~^ ERROR invalid escape `\n` 101 //~| ERROR invalid escape `\"` 102 //~| ERROR invalid escape `\'` 103 } 104