summaryrefslogtreecommitdiffstats
path: root/src/test/ui-fulldeps/fluent-messages/test.rs
blob: 0390a07850b41ee04dbc88c843df682d503f7d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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>>),
}

/// 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>),
}

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! {
        a => "./duplicate-a.ftl",
        b => "./duplicate-b.ftl",
//~^ ERROR overrides existing message: `key`
    }
}

mod valid {
    use super::fluent_messages;

    fluent_messages! {
        valid => "./valid.ftl",
    }

    use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::valid};
}