Skip to content

Commit

Permalink
Test braces-to-parens with two curried params
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 5, 2024
1 parent d99ed9c commit 9009432
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10918,6 +10918,53 @@ Utils.tryWithSafeFinally {
} {
serializeStream.close()
}
<<< #4133 braces to parens with two curried params 2
maxColumn = 74
rewrite.rules = [RedundantBraces]
===
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
>>>
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
<<< #4133 braces to parens with two curried params, second func
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with two curried params, second func and comment
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with func
preset = default
newlines.source = fold
Expand Down
60 changes: 60 additions & 0 deletions scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat
Original file line number Diff line number Diff line change
Expand Up @@ -10202,6 +10202,66 @@ Utils.tryWithSafeFinally {
Utils.tryWithSafeFinally {
serializeStream.writeObject(partitioner)
}(serializeStream.close())
<<< #4133 braces to parens with two curried params 2
maxColumn = 74
rewrite.rules = [RedundantBraces]
===
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
>>>
Idempotency violated
=> Diff (- obtained, + expected)
-adjustStart(accept(AT))(ensureApplied(
- parArgumentExprss(wrapNew(simpleType1()))
-))
+adjustStart(
+ accept(AT)
+)(ensureApplied(parArgumentExprss(wrapNew(simpleType1()))))
<<< #4133 braces to parens with two curried params, second func
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
Idempotency violated
=> Diff (- obtained, + expected)
-val offsets = Utils.tryWithResource(new DataInputStream(
- Files.newInputStream(indexFile.toPath)
-)) { dis =>
- dis.readFully(buffer.array)
- buffer.asLongBuffer
-}
+val offsets = Utils
+ .tryWithResource(new DataInputStream(Files.newInputStream(indexFile.toPath))) {
+ dis =>
+ dis.readFully(buffer.array)
+ buffer.asLongBuffer
+ }
<<< #4133 braces to parens with two curried params, second func and comment
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with func
preset = default
newlines.source = fold
Expand Down
47 changes: 47 additions & 0 deletions scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat
Original file line number Diff line number Diff line change
Expand Up @@ -10671,6 +10671,53 @@ Utils.tryWithSafeFinally {
} {
serializeStream.close()
}
<<< #4133 braces to parens with two curried params 2
maxColumn = 74
rewrite.rules = [RedundantBraces]
===
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
>>>
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
<<< #4133 braces to parens with two curried params, second func
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with two curried params, second func and comment
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with func
preset = default
newlines.source = fold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11061,6 +11061,55 @@ Utils.tryWithSafeFinally {
} {
serializeStream.close()
}
<<< #4133 braces to parens with two curried params 2
maxColumn = 74
rewrite.rules = [RedundantBraces]
===
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
>>>
adjustStart(accept(AT)) {
ensureApplied(parArgumentExprss(wrapNew(simpleType1())))
}
<<< #4133 braces to parens with two curried params, second func
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets =
Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with two curried params, second func and comment
maxColumn = 76
newlines.avoidForSimpleOverflow = all
rewrite.rules = [RedundantBraces]
===
val offsets = Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
>>>
val offsets =
Utils.tryWithResource {
new DataInputStream(Files.newInputStream(indexFile.toPath))
} { dis =>
// dis.readFully(buffer.array)
buffer.asLongBuffer
}
<<< #4133 braces to parens with func
preset = default
newlines.source = fold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
val explored = Debug.explored.get()
logger.debug(s"Total explored: $explored")
if (!onlyUnit && !onlyManual)
assertEquals(explored, 1498031, "total explored")
assertEquals(explored, 1499055, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit 9009432

Please sign in to comment.