fluent: update tests

This commit is contained in:
Xiretza 2022-08-17 13:05:13 +02:00
parent 28b29db8f0
commit 0c7da94be0
9 changed files with 60 additions and 21 deletions

View File

@ -0,0 +1 @@
a_b_key = Value

View File

@ -1 +1 @@
key = Value
a_b_key = Value

View File

@ -1 +0,0 @@
key = Value

View File

@ -1,2 +1,2 @@
some_slug = hi
label_with_hyphens_some_slug = hi
.label-has-hyphens = test

View File

@ -0,0 +1,2 @@
with-hyphens = 1234
test-crate_foo = abcd

View File

@ -1 +1 @@
this-slug-has-hyphens = hi
slug_with_hyphens_this-slug-has-hyphens = hi

View File

@ -50,8 +50,8 @@ mod duplicate {
fluent_messages! {
a => "./duplicate-a.ftl",
b => "./duplicate-b.ftl",
//~^ ERROR overrides existing message: `key`
a_b => "./duplicate-a-b.ftl",
//~^ ERROR overrides existing message: `a_b_key`
}
}
@ -60,7 +60,7 @@ mod slug_with_hyphens {
fluent_messages! {
slug_with_hyphens => "./slug-with-hyphens.ftl",
//~^ ERROR name `this-slug-has-hyphens` contains a '-' character
//~^ ERROR name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
}
}
@ -80,5 +80,18 @@ mod valid {
valid => "./valid.ftl",
}
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::valid};
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::key};
}
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
}
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate::{foo, with_hyphens}};
}

View File

@ -29,33 +29,57 @@ error: expected a message field for "missing_message"
| ^^^^^^^^^^^^^^^^^
|
error: overrides existing message: `key`
--> $DIR/test.rs:53:9
error: overrides existing message: `a_b_key`
--> $DIR/test.rs:53:16
|
LL | b => "./duplicate-b.ftl",
| ^
LL | a_b => "./duplicate-a-b.ftl",
| ^^^^^^^^^^^^^^^^^^^^^
|
help: previously defined in this resource
--> $DIR/test.rs:52:9
--> $DIR/test.rs:52:14
|
LL | a => "./duplicate-a.ftl",
| ^
| ^^^^^^^^^^^^^^^^^^^
error: name `this-slug-has-hyphens` contains a '-' character
--> $DIR/test.rs:62:9
error: name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
--> $DIR/test.rs:62:30
|
LL | slug_with_hyphens => "./slug-with-hyphens.ftl",
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: replace any '-'s with '_'s
error: attribute `label-has-hyphens` contains a '-' character
--> $DIR/test.rs:71:9
--> $DIR/test.rs:71:31
|
LL | label_with_hyphens => "./label-with-hyphens.ftl",
| ^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: replace any '-'s with '_'s
error: aborting due to 6 previous errors
error: name `with-hyphens` contains a '-' character
--> $DIR/test.rs:90:23
|
LL | test_crate => "./missing-crate-name.ftl",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: replace any '-'s with '_'s
error: name `with-hyphens` does not start with the crate name
--> $DIR/test.rs:90:23
|
LL | test_crate => "./missing-crate-name.ftl",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: prepend `test_crate_` to the slug name: `test_crate_with_hyphens`
error: name `test-crate_foo` contains a '-' character
--> $DIR/test.rs:90:23
|
LL | test_crate => "./missing-crate-name.ftl",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: replace any '-'s with '_'s
error: aborting due to 9 previous errors

View File

@ -1 +1 @@
valid = Valid!
valid_key = Valid!