mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Merge branch 'trunk' into infer-exposing
This commit is contained in:
commit
b79b10f4ec
1 changed files with 160 additions and 0 deletions
|
@ -91,6 +91,54 @@ mod test_format {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_with_comment() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
# This variable is for greeting
|
||||
a = "Hello"
|
||||
a
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_with_comment_and_extra_space() {
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r#"
|
||||
# This variable is for greeting
|
||||
|
||||
|
||||
|
||||
|
||||
a = "Hello"
|
||||
a
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
# This variable is for greeting
|
||||
|
||||
a = "Hello"
|
||||
a
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn func_def() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
f = \x y ->
|
||||
x
|
||||
|
||||
f 4
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_string() {
|
||||
expr_formats_same(indoc!(
|
||||
|
@ -228,6 +276,90 @@ mod test_format {
|
|||
42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_to(
|
||||
indoc!(
|
||||
r#"
|
||||
x = 5
|
||||
|
||||
|
||||
y = 10
|
||||
|
||||
42
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
x = 5
|
||||
|
||||
y = 10
|
||||
|
||||
42
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comment_between_two_defs() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
x = 5
|
||||
# Hello
|
||||
y = 10
|
||||
|
||||
42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
x = 5
|
||||
# Hello
|
||||
# two comments
|
||||
y = 10
|
||||
|
||||
42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
x = 5
|
||||
# Hello
|
||||
# two comments
|
||||
y = 10
|
||||
|
||||
# v-- This is the return value
|
||||
|
||||
42
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn space_between_comments() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
# 9
|
||||
|
||||
# A
|
||||
# B
|
||||
|
||||
# C
|
||||
9
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doesnt_detect_comment_in_comment() {
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
# One Comment # Still one Comment
|
||||
9
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -240,6 +372,17 @@ mod test_format {
|
|||
42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
# A
|
||||
(UserId userId) = 5
|
||||
# B
|
||||
y = 10
|
||||
|
||||
42
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -273,6 +416,23 @@ mod test_format {
|
|||
identity 42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
identity = \a ->
|
||||
a
|
||||
|
||||
identity 42
|
||||
"#
|
||||
));
|
||||
|
||||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
identity = \a -> a
|
||||
# Hello
|
||||
identity 42
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
// RECORD LITERALS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue