diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /tests/ui-fulldeps/fluent-messages | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.tar.xz rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps/fluent-messages')
9 files changed, 83 insertions, 94 deletions
diff --git a/tests/ui-fulldeps/fluent-messages/duplicate.ftl b/tests/ui-fulldeps/fluent-messages/duplicate.ftl new file mode 100644 index 000000000..871550b23 --- /dev/null +++ b/tests/ui-fulldeps/fluent-messages/duplicate.ftl @@ -0,0 +1,3 @@ +no_crate_a_b_key = Value + +no_crate_a_b_key = Another Value diff --git a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl index 016cbeef6..3088b1f8d 100644 --- a/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl +++ b/tests/ui-fulldeps/fluent-messages/label-with-hyphens.ftl @@ -1,2 +1,2 @@ -label_with_hyphens_some_slug = hi +no_crate_some_slug = hi .label-has-hyphens = test diff --git a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl b/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl index 9bd035c1b..0a64e3894 100644 --- a/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl +++ b/tests/ui-fulldeps/fluent-messages/missing-crate-name.ftl @@ -1,2 +1,2 @@ with-hyphens = 1234 -test-crate_foo = abcd +no-crate_foo = abcd diff --git a/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl b/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl new file mode 100644 index 000000000..4c6514a97 --- /dev/null +++ b/tests/ui-fulldeps/fluent-messages/missing-message-ref.ftl @@ -0,0 +1 @@ +no_crate_missing_message_ref = {message} diff --git a/tests/ui-fulldeps/fluent-messages/missing-message.ftl b/tests/ui-fulldeps/fluent-messages/missing-message.ftl index 74b2aa1d4..61f56fd4d 100644 --- a/tests/ui-fulldeps/fluent-messages/missing-message.ftl +++ b/tests/ui-fulldeps/fluent-messages/missing-message.ftl @@ -1 +1 @@ -missing_message = +no_crate_missing_message = diff --git a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl b/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl index 86ba9a268..a64c85094 100644 --- a/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl +++ b/tests/ui-fulldeps/fluent-messages/slug-with-hyphens.ftl @@ -1 +1 @@ -slug_with_hyphens_this-slug-has-hyphens = hi +no_crate_this-slug-has-hyphens = hi diff --git a/tests/ui-fulldeps/fluent-messages/test.rs b/tests/ui-fulldeps/fluent-messages/test.rs index 4e8147e2b..66575eb8e 100644 --- a/tests/ui-fulldeps/fluent-messages/test.rs +++ b/tests/ui-fulldeps/fluent-messages/test.rs @@ -21,78 +21,74 @@ pub enum SubdiagnosticMessage { mod missing_absolute { use super::fluent_messages; - fluent_messages! { - missing_absolute => "/definitely_does_not_exist.ftl", -//~^ ERROR could not open Fluent resource - } + fluent_messages! { "/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 - } + fluent_messages! { "../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 - } + fluent_messages! { "./missing-message.ftl" } + //~^ ERROR could not parse Fluent resource } mod duplicate { use super::fluent_messages; - fluent_messages! { -//~^ ERROR the name `a_b_key` is defined multiple times - a => "./duplicate-a.ftl", - a_b => "./duplicate-a-b.ftl", -//~^ ERROR overrides existing message: `a_b_key` - } + fluent_messages! { "./duplicate.ftl" } + //~^ ERROR overrides existing message: `no_crate_a_b_key` } mod slug_with_hyphens { use super::fluent_messages; - fluent_messages! { - slug_with_hyphens => "./slug-with-hyphens.ftl", -//~^ ERROR name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character - } + fluent_messages! { "./slug-with-hyphens.ftl" } + //~^ ERROR name `no_crate_this-slug-has-hyphens` contains a '-' character } 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 - } + fluent_messages! { "./label-with-hyphens.ftl" } + //~^ ERROR attribute `label-has-hyphens` contains a '-' character } mod valid { use super::fluent_messages; - fluent_messages! { - valid => "./valid.ftl", - } + fluent_messages! { "./valid.ftl" } - use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid_key}; + mod test_generated { + use super::{fluent_generated::no_crate_key, DEFAULT_LOCALE_RESOURCE}; + } } 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 + fluent_messages! { "./missing-crate-name.ftl" } + //~^ 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 + + mod test_generated { + use super::{ + fluent_generated::{no_crate_foo, with_hyphens}, + DEFAULT_LOCALE_RESOURCE, + }; } +} + +mod missing_message_ref { + use super::fluent_messages; - use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate_foo, with_hyphens}; + fluent_messages! { "./missing-message-ref.ftl" } + //~^ ERROR referenced message `message` does not exist } diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr index d1cd4fe26..c7961ed22 100644 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ b/tests/ui-fulldeps/fluent-messages/test.stderr @@ -1,98 +1,87 @@ error: could not open Fluent resource - --> $DIR/test.rs:25:29 + --> $DIR/test.rs:24:24 | -LL | missing_absolute => "/definitely_does_not_exist.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "/definitely_does_not_exist.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: os-specific message error: could not open Fluent resource - --> $DIR/test.rs:34:29 + --> $DIR/test.rs:31:24 | -LL | missing_relative => "../definitely_does_not_exist.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "../definitely_does_not_exist.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: os-specific message error: could not parse Fluent resource - --> $DIR/test.rs:43:28 + --> $DIR/test.rs:38:24 | -LL | missing_message => "./missing-message.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-message.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: see additional errors emitted -error: expected a message field for "missing_message" +error: expected a message field for "no_crate_missing_message" --> ./missing-message.ftl:1:1 | -1 | missing_message = - | ^^^^^^^^^^^^^^^^^ +1 | no_crate_missing_message = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -error: overrides existing message: `a_b_key` - --> $DIR/test.rs:54:16 +error: overrides existing message: `no_crate_a_b_key` + --> $DIR/test.rs:45:24 | -LL | a_b => "./duplicate-a-b.ftl", - | ^^^^^^^^^^^^^^^^^^^^^ - | -help: previously defined in this resource - --> $DIR/test.rs:53:14 - | -LL | a => "./duplicate-a.ftl", - | ^^^^^^^^^^^^^^^^^^^ - -error[E0428]: the name `a_b_key` is defined multiple times - --> $DIR/test.rs:51:5 - | -LL | fluent_messages! { - | ^^^^^^^^^^^^^^^^ - | | - | `a_b_key` redefined here - | previous definition of the value `a_b_key` here - | - = note: os-specific message - = note: os-specific message +LL | fluent_messages! { "./duplicate.ftl" } + | ^^^^^^^^^^^^^^^^^ -error: name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character - --> $DIR/test.rs:63:30 +error: name `no_crate_this-slug-has-hyphens` contains a '-' character + --> $DIR/test.rs:52:24 | -LL | slug_with_hyphens => "./slug-with-hyphens.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./slug-with-hyphens.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: attribute `label-has-hyphens` contains a '-' character - --> $DIR/test.rs:72:31 + --> $DIR/test.rs:59:24 | -LL | label_with_hyphens => "./label-with-hyphens.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./label-with-hyphens.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: name `with-hyphens` contains a '-' character - --> $DIR/test.rs:91:23 + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s error: name `with-hyphens` does not start with the crate name - --> $DIR/test.rs:91:23 + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: prepend `test_crate_` to the slug name: `test_crate_with_hyphens` + = help: prepend `no_crate_` to the slug name: `no_crate_with_hyphens` -error: name `test-crate_foo` contains a '-' character - --> $DIR/test.rs:91:23 +error: name `no-crate_foo` contains a '-' character + --> $DIR/test.rs:76:24 | -LL | test_crate => "./missing-crate-name.ftl", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fluent_messages! { "./missing-crate-name.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: replace any '-'s with '_'s +error: referenced message `message` does not exist (in message `no_crate_missing_message_ref`) + --> $DIR/test.rs:92:24 + | +LL | fluent_messages! { "./missing-message-ref.ftl" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: you may have meant to use a variable reference (`{$message}`) + error: aborting due to 10 previous errors -For more information about this error, try `rustc --explain E0428`. diff --git a/tests/ui-fulldeps/fluent-messages/valid.ftl b/tests/ui-fulldeps/fluent-messages/valid.ftl index 549274306..598473adb 100644 --- a/tests/ui-fulldeps/fluent-messages/valid.ftl +++ b/tests/ui-fulldeps/fluent-messages/valid.ftl @@ -1 +1 @@ -valid_key = Valid! +no_crate_key = Valid! |