Skip to content

Commit

Permalink
restore missing native platform io
Browse files Browse the repository at this point in the history
  • Loading branch information
majk-p committed Apr 16, 2024
1 parent 3aad768 commit 129a98c
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 22 deletions.
18 changes: 18 additions & 0 deletions munit/native/src/main/scala/munit/internal/io/PlatformIO.scala
@@ -0,0 +1,18 @@
package munit.internal.io

object PlatformIO {
type File = java.io.File
object File {
def separatorChar = java.io.File.separatorChar
}

object Files {
def readAllLines(path: Path): java.util.List[String] =
java.nio.file.Files.readAllLines(path)
}

type Path = java.nio.file.Path
object Paths {
def get(path: String): Path = java.nio.file.Paths.get(path)
}
}
@@ -1,6 +1,6 @@
package munit.internal

import munit.Clue
import munit.diff.Clue
import munit.Location
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
Expand Down
@@ -1,6 +1,6 @@
package munit.internal

import munit.Clue
import munit.diff.Clue
import munit.Location
import scala.quoted._
import scala.language.experimental.macros
Expand Down
2 changes: 2 additions & 0 deletions munit/shared/src/main/scala/munit/Assertions.scala
Expand Up @@ -3,6 +3,8 @@ package munit
import munit.internal.console.{Lines, StackTraces}
import munit.diff.console.Printers
import munit.diff.Printer
import munit.diff.Clue
import munit.diff.Clues
import munit.diff.EmptyPrinter

import scala.reflect.ClassTag
Expand Down
19 changes: 10 additions & 9 deletions munit/shared/src/main/scala/munit/Clue.scala
Expand Up @@ -2,15 +2,16 @@ package munit

import munit.internal.MacroCompat

class Clue[+T](
val source: String,
val value: T,
val valueType: String
) extends Serializable {
override def toString(): String = s"Clue($source, $value)"
}
// class Clue[+T](
// val source: String,
// val value: T,
// val valueType: String
// ) extends Serializable {
// override def toString(): String = s"Clue($source, $value)"
// }
object Clue extends MacroCompat.ClueMacro {
@deprecated("use fromValue instead", "1.0.0")
def empty[T](value: T): Clue[T] = fromValue(value)
def fromValue[T](value: T): Clue[T] = new Clue("", value, "")
def empty[T](value: T): munit.diff.Clue[T] = fromValue(value)
def fromValue[T](value: T): munit.diff.Clue[T] =
new munit.diff.Clue("", value, "")
}
14 changes: 7 additions & 7 deletions munit/shared/src/main/scala/munit/Clues.scala
Expand Up @@ -2,10 +2,10 @@ package munit

import munit.internal.console.Printers

class Clues(val values: List[Clue[_]]) {
override def toString(): String = Printers.print(this)
}
object Clues {
def empty: Clues = new Clues(List())
def fromValue[T](value: T): Clues = new Clues(List(Clue.fromValue(value)))
}
// class Clues(val values: List[Clue[_]]) {
// override def toString(): String = Printers.print(this)
// }
// object Clues {
// def empty: Clues = new Clues(List())
// def fromValue[T](value: T): Clues = new Clues(List(Clue.fromValue(value)))
// }
@@ -1,6 +1,6 @@
package munit.internal

import munit.Clue
import munit.diff.Clue
import munit.Location
import scala.reflect.macros.blackbox.Context
import scala.reflect.macros.TypecheckException
Expand Down
Expand Up @@ -6,7 +6,7 @@ import munit.Location
import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.util.control.NonFatal
import munit.Clues
import munit.diff.Clues

class Lines extends Serializable {
private val filecache = mutable.Map.empty[Path, Array[String]]
Expand Down
4 changes: 2 additions & 2 deletions tests/shared/src/test/scala/munit/TypeCheckSuite.scala
Expand Up @@ -41,7 +41,7 @@ class TypeCheckSuite extends FunSuite {
|
|The following import might make progress towards fixing the problem:
|
| import munit.Clue.generate
| import munit.diff.Clue.generate
|
|msg.foobar
| ^
Expand Down Expand Up @@ -84,7 +84,7 @@ class TypeCheckSuite extends FunSuite {
|
|The following import might make progress towards fixing the problem:
|
| import munit.Clue.generate
| import munit.diff.Clue.generate
|
|val n: Int = msg
| ^
Expand Down

0 comments on commit 129a98c

Please sign in to comment.