mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Make ListStart branch less brittle; Add ListEnd branch
This commit is contained in:
parent
69c36af43e
commit
c28d6b9411
2 changed files with 120 additions and 69 deletions
|
@ -6432,6 +6432,82 @@ All branches in an `if` must have the same type!
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exposes_start() {
|
||||
report_header_problem_as(
|
||||
indoc!(
|
||||
r"
|
||||
module foobar []
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── WEIRD EXPOSES in /code/proj/Main.roc ────────────────────────────────────────
|
||||
|
||||
I am partway through parsing a header, but I got stuck here:
|
||||
|
||||
1│ module foobar []
|
||||
^
|
||||
|
||||
I was expecting an `exposes` list like
|
||||
|
||||
[Animal, default, tame]
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exposes_missing_comma() {
|
||||
report_header_problem_as(
|
||||
indoc!(
|
||||
r"
|
||||
module [value func]
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── WEIRD EXPOSES in /code/proj/Main.roc ────────────────────────────────────────
|
||||
|
||||
I am partway through parsing an `exposes` list, but I got stuck here:
|
||||
|
||||
1│ module [value func]
|
||||
^
|
||||
|
||||
I was expecting a type name, value name or function name next, like
|
||||
|
||||
[Animal, default, tame]
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exposes_end() {
|
||||
report_header_problem_as(
|
||||
indoc!(
|
||||
r"
|
||||
module [value
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── WEIRD EXPOSES in /code/proj/Main.roc ────────────────────────────────────────
|
||||
|
||||
I am partway through parsing an `exposes` list, but I got stuck here:
|
||||
|
||||
1│ module [value
|
||||
2│
|
||||
^
|
||||
|
||||
I was expecting a type name, value name or function name next, like
|
||||
|
||||
[Animal, default, tame]
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_app_name() {
|
||||
report_header_problem_as(
|
||||
|
@ -6458,39 +6534,6 @@ All branches in an `if` must have the same type!
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unneeded_module_name() {
|
||||
report_header_problem_as(
|
||||
indoc!(
|
||||
r"
|
||||
module foobar []
|
||||
"
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── WEIRD MODULE NAME in /code/proj/Main.roc ────────────────────────────────────
|
||||
|
||||
I am partway through parsing a header, but I got stuck here:
|
||||
|
||||
1│ module foobar []
|
||||
^
|
||||
|
||||
I am expecting a list of exports like
|
||||
|
||||
module [func, value]
|
||||
|
||||
or module params like
|
||||
|
||||
module { echo } -> [func, value]
|
||||
|
||||
If you're trying to specify a module name, recall that unlike
|
||||
application names, module names are not specified in the header.
|
||||
Instead, they are derived from the name of the module's filename.
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
test_report!(
|
||||
apply_unary_negative,
|
||||
indoc!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue