Skip to content

Commit 6987322

Browse files
committed
Update translation tests
1 parent c65ebae commit 6987322

File tree

8 files changed

+356
-342
lines changed

8 files changed

+356
-342
lines changed

Diff for: src/test/ui-fulldeps/fluent-messages/test.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ mod duplicate {
4949
use super::fluent_messages;
5050

5151
fluent_messages! {
52+
//~^ ERROR the name `a_b_key` is defined multiple times
5253
a => "./duplicate-a.ftl",
5354
a_b => "./duplicate-a-b.ftl",
5455
//~^ ERROR overrides existing message: `a_b_key`
@@ -80,7 +81,7 @@ mod valid {
8081
valid => "./valid.ftl",
8182
}
8283

83-
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::key};
84+
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid_key};
8485
}
8586

8687
mod missing_crate_name {
@@ -93,5 +94,5 @@ mod missing_crate_name {
9394
//~| ERROR name `with-hyphens` does not start with the crate name
9495
}
9596

96-
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate::{foo, with_hyphens}};
97+
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate_foo, with_hyphens};
9798
}

Diff for: src/test/ui-fulldeps/fluent-messages/test.stderr

+21-8
Original file line numberDiff line numberDiff line change
@@ -30,56 +30,69 @@ error: expected a message field for "missing_message"
3030
|
3131

3232
error: overrides existing message: `a_b_key`
33-
--> $DIR/test.rs:53:16
33+
--> $DIR/test.rs:54:16
3434
|
3535
LL | a_b => "./duplicate-a-b.ftl",
3636
| ^^^^^^^^^^^^^^^^^^^^^
3737
|
3838
help: previously defined in this resource
39-
--> $DIR/test.rs:52:14
39+
--> $DIR/test.rs:53:14
4040
|
4141
LL | a => "./duplicate-a.ftl",
4242
| ^^^^^^^^^^^^^^^^^^^
4343

44+
error[E0428]: the name `a_b_key` is defined multiple times
45+
--> $DIR/test.rs:51:5
46+
|
47+
LL | fluent_messages! {
48+
| ^^^^^^^^^^^^^^^^
49+
| |
50+
| `a_b_key` redefined here
51+
| previous definition of the value `a_b_key` here
52+
|
53+
= note: os-specific message
54+
= note: os-specific message
55+
4456
error: name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
45-
--> $DIR/test.rs:62:30
57+
--> $DIR/test.rs:63:30
4658
|
4759
LL | slug_with_hyphens => "./slug-with-hyphens.ftl",
4860
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4961
|
5062
= help: replace any '-'s with '_'s
5163

5264
error: attribute `label-has-hyphens` contains a '-' character
53-
--> $DIR/test.rs:71:31
65+
--> $DIR/test.rs:72:31
5466
|
5567
LL | label_with_hyphens => "./label-with-hyphens.ftl",
5668
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
5769
|
5870
= help: replace any '-'s with '_'s
5971

6072
error: name `with-hyphens` contains a '-' character
61-
--> $DIR/test.rs:90:23
73+
--> $DIR/test.rs:91:23
6274
|
6375
LL | test_crate => "./missing-crate-name.ftl",
6476
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6577
|
6678
= help: replace any '-'s with '_'s
6779

6880
error: name `with-hyphens` does not start with the crate name
69-
--> $DIR/test.rs:90:23
81+
--> $DIR/test.rs:91:23
7082
|
7183
LL | test_crate => "./missing-crate-name.ftl",
7284
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
7385
|
7486
= help: prepend `test_crate_` to the slug name: `test_crate_with_hyphens`
7587

7688
error: name `test-crate_foo` contains a '-' character
77-
--> $DIR/test.rs:90:23
89+
--> $DIR/test.rs:91:23
7890
|
7991
LL | test_crate => "./missing-crate-name.ftl",
8092
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
8193
|
8294
= help: replace any '-'s with '_'s
8395

84-
error: aborting due to 9 previous errors
96+
error: aborting due to 10 previous errors
8597

98+
For more information about this error, try `rustc --explain E0428`.

Diff for: src/test/ui-fulldeps/internal-lints/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ use rustc_macros::{Diagnostic, Subdiagnostic};
1919
use rustc_span::Span;
2020

2121
#[derive(Diagnostic)]
22-
#[diag(compiletest::example)]
22+
#[diag(compiletest_example)]
2323
struct DeriveDiagnostic {
2424
#[primary_span]
2525
span: Span,
2626
}
2727

2828
#[derive(Subdiagnostic)]
29-
#[note(compiletest::example)]
29+
#[note(compiletest_example)]
3030
struct Note {
3131
#[primary_span]
3232
span: Span,
@@ -45,7 +45,7 @@ pub struct TranslatableInIntoDiagnostic;
4545

4646
impl<'a> IntoDiagnostic<'a, ErrorGuaranteed> for TranslatableInIntoDiagnostic {
4747
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
48-
handler.struct_err(fluent::compiletest::example)
48+
handler.struct_err(fluent::compiletest_example)
4949
}
5050
}
5151

@@ -68,12 +68,12 @@ impl AddToDiagnostic for TranslatableInAddToDiagnostic {
6868
where
6969
F: Fn(&mut Diagnostic, SubdiagnosticMessage) -> SubdiagnosticMessage,
7070
{
71-
diag.note(fluent::compiletest::note);
71+
diag.note(fluent::note);
7272
}
7373
}
7474

7575
pub fn make_diagnostics<'a>(handler: &'a Handler) {
76-
let _diag = handler.struct_err(fluent::compiletest::example);
76+
let _diag = handler.struct_err(fluent::compiletest_example);
7777
//~^ ERROR diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
7878

7979
let _diag = handler.struct_err("untranslatable diagnostic");

Diff for: src/test/ui-fulldeps/internal-lints/diagnostics.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LL | diag.note("untranslatable diagnostic");
1919
error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
2020
--> $DIR/diagnostics.rs:76:25
2121
|
22-
LL | let _diag = handler.struct_err(fluent::compiletest::example);
22+
LL | let _diag = handler.struct_err(fluent::compiletest_example);
2323
| ^^^^^^^^^^
2424
|
2525
note: the lint level is defined here

0 commit comments

Comments
 (0)