Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
keynmol committed Sep 7, 2024
1 parent 691f9cf commit 27d986b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions shared/scalafmt.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ given Featureful[Indents] = Featureful.derive[Indents](
)
)

given Featureful[ScalafmtRunner] = Featureful.derived
case class DialectOptions(dialectName: String)

type ScalafmtConfigSubset = (Docstrings, Comments, Indents, BinPack, OptIn)
given Featureful[DialectOptions] = Featureful.derive(
FieldConfig(
Map(
"dialectName" -> Feature.StringCategory(List("scala213", "scala3"))
)
)
)

type ScalafmtConfigSubset =
(Docstrings, Comments, Indents, BinPack, OptIn, DialectOptions)

class ScalafmtTest extends FunSuite:
test("scalafmt"):
Expand All @@ -74,6 +83,10 @@ class ScalafmtTest extends FunSuite:
import com.github.vickumar1981.stringdistance.StringDistance.*
import com.github.vickumar1981.stringdistance.impl.ConstantGap

val dialect = cfg._6.dialectName match
case "scala213" => scala.meta.dialects.Scala213
case "scala3" => scala.meta.dialects.Scala3

cache.computeIfAbsent(
cfg,
{ _ =>
Expand All @@ -86,7 +99,7 @@ class ScalafmtTest extends FunSuite:
indent = cfg._3,
binPack = cfg._4,
optIn = cfg._5
)
).withDialect(dialect)
)
.toEither
.fold(
Expand All @@ -111,7 +124,7 @@ class ScalafmtTest extends FunSuite:
val trainingConfig = TrainingConfig(
populationSize = 100,
mutationRate = NormalisedFloat(0.8f),
steps = 5,
steps = 100,
random = scala.util.Random(80085L),
selection = Selection.Top(0.8)
)
Expand Down

0 comments on commit 27d986b

Please sign in to comment.