Check for escape sequences in Fluent resources
This commit is contained in:
parent
bf57e8ada6
commit
979c265a5d
9 changed files with 64 additions and 9 deletions
1
tests/ui-fulldeps/fluent-messages/invalid-escape.ftl
Normal file
1
tests/ui-fulldeps/fluent-messages/invalid-escape.ftl
Normal file
|
@ -0,0 +1 @@
|
|||
no_crate_bad_escape = don't use \n, \', or \"
|
|
@ -92,3 +92,12 @@ mod missing_message_ref {
|
|||
fluent_messages! { "./missing-message-ref.ftl" }
|
||||
//~^ ERROR referenced message `message` does not exist
|
||||
}
|
||||
|
||||
mod bad_escape {
|
||||
use super::fluent_messages;
|
||||
|
||||
fluent_messages! { "./invalid-escape.ftl" }
|
||||
//~^ ERROR invalid escape `\n`
|
||||
//~| ERROR invalid escape `\"`
|
||||
//~| ERROR invalid escape `\'`
|
||||
}
|
||||
|
|
|
@ -83,5 +83,29 @@ 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
|
||||
error: invalid escape `\n` in Fluent resource
|
||||
--> $DIR/test.rs:99:24
|
||||
|
|
||||
LL | fluent_messages! { "./invalid-escape.ftl" }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: os-specific message
|
||||
|
||||
error: invalid escape `\"` in Fluent resource
|
||||
--> $DIR/test.rs:99:24
|
||||
|
|
||||
LL | fluent_messages! { "./invalid-escape.ftl" }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: os-specific message
|
||||
|
||||
error: invalid escape `\'` in Fluent resource
|
||||
--> $DIR/test.rs:99:24
|
||||
|
|
||||
LL | fluent_messages! { "./invalid-escape.ftl" }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: os-specific message
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: found non-existing keyword `tadam` used in `#[doc(keyword = \"...\")]`
|
||||
error: found non-existing keyword `tadam` used in `#[doc(keyword = "...")]`
|
||||
--> $DIR/existing_doc_keyword.rs:10:1
|
||||
|
|
||||
LL | #[doc(keyword = "tadam")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue