Skip to content

Commit

Permalink
Add an if statement test around condition breaking (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan authored Dec 20, 2024
1 parent c4f0861 commit 5446d7e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/air_r_formatter/tests/specs/r/if_statement.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@ if (a # becomes trailing on `a`
) {
TRUE
}

# Breaks, but the `condition` itself fits and is not expanded
if (this || this || this || this || this || this || this || this || this || this) {
1
} else {
2
}
# Breaks, but the `condition` itself also doesn't fit and is also expanded
if (this || this || this || this || this || this || this || this || this || this || this || this) {
1
} else {
2
}
41 changes: 41 additions & 0 deletions crates/air_r_formatter/tests/specs/r/if_statement.R.snap
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ if (a # becomes trailing on `a`
TRUE
}
# Breaks, but the `condition` itself fits and is not expanded
if (this || this || this || this || this || this || this || this || this || this) {
1
} else {
2
}
# Breaks, but the `condition` itself also doesn't fit and is also expanded
if (this || this || this || this || this || this || this || this || this || this || this || this) {
1
} else {
2
}
```


Expand Down Expand Up @@ -104,4 +117,32 @@ if (
) {
TRUE
}
# Breaks, but the `condition` itself fits and is not expanded
if (
this || this || this || this || this || this || this || this || this || this
) {
1
} else {
2
}
# Breaks, but the `condition` itself also doesn't fit and is also expanded
if (
this ||
this ||
this ||
this ||
this ||
this ||
this ||
this ||
this ||
this ||
this ||
this
) {
1
} else {
2
}
```

0 comments on commit 5446d7e

Please sign in to comment.