mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Merge pull request #7408 from jaredramirez/jared/improve-module-error
Handle parse error for bad head exposes list
This commit is contained in:
commit
786488fc34
2 changed files with 135 additions and 17 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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue