Skip to content

Commit

Permalink
Add a full structure test for intermittent failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Sep 14, 2023
1 parent c1843ce commit 331326b
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.scalafmt

import munit.FunSuite

import scala.meta._
import scala.meta.internal.parsers.ScalametaParser

class CustomStructureTest extends FunSuite {

private def check(
original: String,
expected: Tree,
dialect: Dialect
)(implicit loc: munit.Location): Unit = {
val parser = new ScalametaParser(Input.String(original))(dialect)
assertNoDiff(parser.parseStat().structure, expected.structure)
}

// #3634
check(
"""
|def foo(a: Foo[_]): Unit = ???
""".stripMargin,
Defn.Def(
Nil,
Term.Name("foo"),
List(
Member.ParamClauseGroup(
Type.ParamClause(Nil),
List(
Term.ParamClause(
List(
Term.Param(
Nil,
Term.Name("a"),
Some(
Type.Apply(
Type.Name("Foo"),
Type.ArgClause(
List(Type.Wildcard(Type.Bounds(None, None)))
)
)
),
None
)
),
None
)
)
)
),
Some(Type.Name("Unit")),
Term.Name("???")
),
dialects.Scala3
)

}

0 comments on commit 331326b

Please sign in to comment.