Add test for Scala Native #3293 that should be resolved in v.0.4.13

This commit is contained in:
Jarek Sacha 2023-06-05 18:51:09 -04:00
parent 47674de560
commit c30b853f64
No known key found for this signature in database
GPG key ID: F29625CE62288163
2 changed files with 33 additions and 4 deletions

View file

@ -1,4 +1,4 @@
scalaVersion := "3.3.0"
scalaVersion := "3.3.0"
//name := "IJP-ImageJ-Launcher"
version := "0.1.1-SNAPSHOT"
versionScheme := Some("early-semver")
@ -16,14 +16,15 @@ enablePlugins(ScalaNativePlugin)
logLevel := Level.Info
libraryDependencies ++= Seq(
"com.github.scopt" %%% "scopt" % "4.1.0",
"com.lihaoyi" %%% "os-lib" % "0.9.1"
"com.github.scopt" %%% "scopt" % "4.1.0",
"com.lihaoyi" %%% "os-lib" % "0.9.1",
"org.scalatest" %%% "scalatest" % "3.2.16" % Test
)
Compile / run / mainClass := Some("ij_plugins.imagej_launcher.Main")
// import to add Scala Native options
import scala.scalanative.build._
import scala.scalanative.build.*
// defaults set with common options shown
nativeConfig ~= { c =>

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2000-2023 Jarek Sacha. All Rights Reserved.
* Author's e-mail: jpsacha at gmail.com
*/
package ij_plugins.imagej_launcher
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should
import java.nio.file.FileSystems
import scala.scalanative.runtime.Platform.isWindows
class PathSpec extends AnyFlatSpec with should.Matchers:
"A Path" should "should `relativize` jars on Windows (Scala Native #3293)" in {
if isWindows() then
// This to test that fix for Scala Native #3293 implemented, it should be part of Scala Native 0.4.13
// See https://github.com/scala-native/scala-native/issues/3293
// val src = Path.of("C:\\a\\b\\c.jar")
val src = FileSystems.getDefault.getPath("C:\\a\\b\\c.jar")
// val base = Path.of("C:\\a")
val base = FileSystems.getDefault.getPath("C:\\a")
val rel = base.relativize(src)
rel.toString should be("b\\c.jar")
}