Skip to content

Commit 3e6c7a0

Browse files
Ertanicalerque
authored andcommitted
refactor(fluent-syntax): Use pre-formatted messages for roundtrip_unnormalized_fixtures()
...and compare with expected span data.
1 parent 7b08bb1 commit 3e6c7a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1480
-18
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
*.ftl eol=lf
22

3-
fluent-syntax/tests/fixtures/crlf.ftl eol=crlf
43
fluent-syntax/tests/fixtures/cr.ftl eol=cr
4+
fluent-syntax/tests/fixtures/crlf.ftl eol=crlf
5+
fluent-syntax/tests/fixtures/formatted/cr.ftl eol=cr
6+
fluent-syntax/tests/fixtures/formatted/junked/cr.ftl eol=cr
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ↓ BEL, U+0007
2+
control0 = abcdef
3+
# ↓ DEL, U+007F
4+
delete = abcdef
5+
# ↓ BPM, U+0082
6+
control1 = abc‚def
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
face-with-tears-of-joy = 😂
2+
tetragram-for-centre = 𝌆
3+
surrogates-in-text = \uD83D\uDE02
4+
surrogates-in-string = { "\uD83D\uDE02" }
5+
surrogates-in-adjacent-strings = { "\uD83D" }{ "\uDE02" }
6+
emoji-in-text = A face 😂 with tears of joy.
7+
emoji-in-string = { "A face 😂 with tears of joy." }
8+
9+
# ERROR Invalid identifier
10+
11+
# ERROR Invalid expression
12+
13+
# ERROR Invalid variant key
14+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Function names
2+
3+
valid-func-name-01 = { FUN1() }
4+
valid-func-name-02 = { FUN_FUN() }
5+
valid-func-name-03 = { FUN-FUN() }
6+
7+
# JUNK 0 is not a valid Identifier start
8+
9+
# JUNK Function names may not be lowercase
10+
11+
# JUNK Function names may not contain lowercase character
12+
13+
# JUNK ? is not a valid Identifier character
14+
15+
## Arguments
16+
17+
positional-args = { FUN(1, "a", msg) }
18+
named-args = { FUN(x: 1, y: "Y") }
19+
dense-named-args = { FUN(x: 1, y: "Y") }
20+
mixed-args = { FUN(1, "a", msg, x: 1, y: "Y") }
21+
22+
# ERROR Positional arg must not follow keyword args
23+
24+
# ERROR Named arguments must be unique
25+
26+
## Whitespace around arguments
27+
28+
sparse-inline-call = { FUN("a", msg, x: 1) }
29+
empty-inline-call = { FUN() }
30+
multiline-call = { FUN("a", msg, x: 1) }
31+
sparse-multiline-call = { FUN("a", msg, x: 1) }
32+
empty-multiline-call = { FUN() }
33+
unindented-arg-number = { FUN(1) }
34+
unindented-arg-string = { FUN("a") }
35+
unindented-arg-msg-ref = { FUN(msg) }
36+
unindented-arg-term-ref = { FUN(-msg) }
37+
unindented-arg-var-ref = { FUN($var) }
38+
unindented-arg-call = { FUN(OTHER()) }
39+
unindented-named-arg = { FUN(x: 1) }
40+
unindented-closing-paren = { FUN(x) }
41+
42+
## Optional trailing comma
43+
44+
one-argument = { FUN(1) }
45+
many-arguments = { FUN(1, 2, 3) }
46+
inline-sparse-args = { FUN(1, 2, 3) }
47+
mulitline-args = { FUN(1, 2) }
48+
mulitline-sparse-args = { FUN(1, 2) }
49+
50+
## Syntax errors for trailing comma
51+
52+
## Whitespace in named arguments
53+
54+
sparse-named-arg = { FUN(x: 1, y: 2, z: 3) }
55+
unindented-colon = { FUN(x: 1) }
56+
unindented-value = { FUN(x: 1) }
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Callees in placeables.
2+
3+
function-callee-placeable = { FUNCTION() }
4+
term-callee-placeable = { -term() }
5+
6+
# ERROR Messages cannot be parameterized.
7+
8+
# ERROR Equivalent to a MessageReference callee.
9+
10+
# ERROR Message attributes cannot be parameterized.
11+
12+
# ERROR Term attributes may not be used in Placeables.
13+
14+
# ERROR Variables cannot be parameterized.
15+
16+
## Callees in selectors.
17+
18+
function-callee-selector =
19+
{ FUNCTION() ->
20+
*[key] Value
21+
}
22+
term-attr-callee-selector =
23+
{ -term.attr() ->
24+
*[key] Value
25+
}
26+
27+
# ERROR Messages cannot be parameterized.
28+
29+
# ERROR Equivalent to a MessageReference callee.
30+
31+
# ERROR Message attributes cannot be parameterized.
32+
33+
# ERROR Term values may not be used as selectors.
34+
35+
# ERROR Variables cannot be parameterized.
36+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Standalone Comment
2+
3+
# Message Comment
4+
foo = Foo
5+
# Term Comment
6+
# with a blank last line.
7+
#
8+
-term = Term
9+
10+
# Another standalone
11+
#
12+
# with indent
13+
14+
15+
## Group Comment
16+
17+
18+
### Resource Comment
19+
20+
21+
# Errors
22+

fluent-syntax/tests/fixtures/formatted/cr.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### This entire file uses CR as EOL.err01 = Value 01err02 = Value 02err03 = Value 03 Continued .title = Titleerr04 = { "strerr05 = { $sel -> }
2+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### NOTE: Disable final newline insertion when editing this file.
2+
3+
4+
# No EOL
5+

fluent-syntax/tests/fixtures/formatted/eof_empty.ftl

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### NOTE: Disable final newline insertion when editing this file.
2+

0 commit comments

Comments
 (0)