<commit_before>package scala.meta
package tests

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import scala.meta.testkit.DiffAssertions
import scala.meta.internal.io.FileIO
import scala.meta.internal.io.InputStreamIO
import scala.meta.internal.io.PathIO
import org.scalatest.FunSuite

class SemanticdbExpectSuite extends FunSuite with DiffAssertions {
  test("semanticdb.expect") {
    val obtained = SemanticdbExpectSuite.getMirror.toString
    val expected = new String(Files.readAllBytes(SemanticdbExpectSuite.expectPath))
    assertNoDiff(obtained, expected)
  }
}

object SemanticdbExpectSuite {
  val expectPath: Path =
    Paths.get("scalameta", "tests", "jvm", "src", "test", "resources", "semanticdb.expect")
  def getMirror: Mirror = {
    val mirror = Database.load(Classpath(BuildInfo.mirrorClasspath))
    val normalizedMirror = Database(mirror.entries.map {
      case (input, attrs) =>
        val normalizedAttrs = attrs.copy(dialect = dialects.Scala212)
        input -> normalizedAttrs
    })
    normalizedMirror
  }
}

// To save the current behavior, run:
// testsJVM/test:runMain scala.meta.tests.SaveSemanticdbExpectTest
object SaveSemanticdbExpectTest {
  def main(args: Array[String]): Unit = {
    val mirror = SemanticdbExpectSuite.getMirror
    Files.write(SemanticdbExpectSuite.expectPath, mirror.toString.getBytes("UTF-8"))
  }
}
<commit_msg>Normalize file paths in expect tests for windows compat.<commit_after>package scala.meta
package tests

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import scala.meta.testkit.DiffAssertions
import scala.meta.internal.io.FileIO
import scala.meta.internal.io.InputStreamIO
import scala.meta.internal.io.PathIO
import org.scalatest.FunSuite

class SemanticdbExpectSuite extends FunSuite with DiffAssertions {
  test("semanticdb.expect") {
    val obtained = SemanticdbExpectSuite.getMirror.toString
    val expected = new String(Files.readAllBytes(SemanticdbExpectSuite.expectPath))
    assertNoDiff(obtained, expected)
  }
}

object SemanticdbExpectSuite {
  val expectPath: Path =
    Paths.get("scalameta", "tests", "jvm", "src", "test", "resources", "semanticdb.expect")
  def getMirror: Mirror = {
    val mirror = Database.load(Classpath(BuildInfo.mirrorClasspath))
    val normalizedMirror = Database(mirror.entries.map {
      case (input: Input.LabeledString, attrs) =>
        val normalizedAttrs = attrs.copy(dialect = dialects.Scala212)
        val normalizedInput = input.copy(label = PathIO.toUnix(input.label))
        normalizedInput -> normalizedAttrs
      case (input, _) => sys.error(s"Unexpected input $input")
    })
    normalizedMirror
  }
}

// To save the current behavior, run:
// testsJVM/test:runMain scala.meta.tests.SaveSemanticdbExpectTest
object SaveSemanticdbExpectTest {
  def main(args: Array[String]): Unit = {
    val mirror = SemanticdbExpectSuite.getMirror
    Files.write(SemanticdbExpectSuite.expectPath, mirror.toString.getBytes("UTF-8"))
  }
}

{'fraction_non_alphanumeric': 0.1047587574355585, 'fraction_numerical': 0.0026437541308658294, 'mean_word_length': 4.595194085027726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6037751', 'n_tokens_mistral': 948, 'n_tokens_neox': 930, 'n_words': 190}