Skip to content

Commit 0c7da94

Browse files
committed
fluent: update tests
1 parent 28b29db commit 0c7da94

File tree

9 files changed

+60
-21
lines changed

9 files changed

+60
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a_b_key = Value
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
key = Value
1+
a_b_key = Value

src/test/ui-fulldeps/fluent-messages/duplicate-b.ftl

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
some_slug = hi
1+
label_with_hyphens_some_slug = hi
22
.label-has-hyphens = test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
with-hyphens = 1234
2+
test-crate_foo = abcd
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
this-slug-has-hyphens = hi
1+
slug_with_hyphens_this-slug-has-hyphens = hi

src/test/ui-fulldeps/fluent-messages/test.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ mod duplicate {
5050

5151
fluent_messages! {
5252
a => "./duplicate-a.ftl",
53-
b => "./duplicate-b.ftl",
54-
//~^ ERROR overrides existing message: `key`
53+
a_b => "./duplicate-a-b.ftl",
54+
//~^ ERROR overrides existing message: `a_b_key`
5555
}
5656
}
5757

@@ -60,7 +60,7 @@ mod slug_with_hyphens {
6060

6161
fluent_messages! {
6262
slug_with_hyphens => "./slug-with-hyphens.ftl",
63-
//~^ ERROR name `this-slug-has-hyphens` contains a '-' character
63+
//~^ ERROR name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
6464
}
6565
}
6666

@@ -80,5 +80,18 @@ mod valid {
8080
valid => "./valid.ftl",
8181
}
8282

83-
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::valid};
83+
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, valid::key};
84+
}
85+
86+
mod missing_crate_name {
87+
use super::fluent_messages;
88+
89+
fluent_messages! {
90+
test_crate => "./missing-crate-name.ftl",
91+
//~^ ERROR name `test-crate_foo` contains a '-' character
92+
//~| ERROR name `with-hyphens` contains a '-' character
93+
//~| ERROR name `with-hyphens` does not start with the crate name
94+
}
95+
96+
use self::fluent_generated::{DEFAULT_LOCALE_RESOURCES, test_crate::{foo, with_hyphens}};
8497
}

src/test/ui-fulldeps/fluent-messages/test.stderr

+36-12
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,57 @@ error: expected a message field for "missing_message"
2929
| ^^^^^^^^^^^^^^^^^
3030
|
3131

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

44-
error: name `this-slug-has-hyphens` contains a '-' character
45-
--> $DIR/test.rs:62:9
44+
error: name `slug_with_hyphens_this-slug-has-hyphens` contains a '-' character
45+
--> $DIR/test.rs:62:30
4646
|
4747
LL | slug_with_hyphens => "./slug-with-hyphens.ftl",
48-
| ^^^^^^^^^^^^^^^^^
48+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4949
|
5050
= help: replace any '-'s with '_'s
5151

5252
error: attribute `label-has-hyphens` contains a '-' character
53-
--> $DIR/test.rs:71:9
53+
--> $DIR/test.rs:71:31
5454
|
5555
LL | label_with_hyphens => "./label-with-hyphens.ftl",
56-
| ^^^^^^^^^^^^^^^^^^
56+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
5757
|
5858
= help: replace any '-'s with '_'s
5959

60-
error: aborting due to 6 previous errors
60+
error: name `with-hyphens` contains a '-' character
61+
--> $DIR/test.rs:90:23
62+
|
63+
LL | test_crate => "./missing-crate-name.ftl",
64+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
65+
|
66+
= help: replace any '-'s with '_'s
67+
68+
error: name `with-hyphens` does not start with the crate name
69+
--> $DIR/test.rs:90:23
70+
|
71+
LL | test_crate => "./missing-crate-name.ftl",
72+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
|
74+
= help: prepend `test_crate_` to the slug name: `test_crate_with_hyphens`
75+
76+
error: name `test-crate_foo` contains a '-' character
77+
--> $DIR/test.rs:90:23
78+
|
79+
LL | test_crate => "./missing-crate-name.ftl",
80+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
81+
|
82+
= help: replace any '-'s with '_'s
83+
84+
error: aborting due to 9 previous errors
6185

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
valid = Valid!
1+
valid_key = Valid!

0 commit comments

Comments
 (0)