Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix expecty macro #307

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
removing expecty dependency from native,
moving Expecty tests to separate Suite,
running expecty tests only on jvm
  • Loading branch information
pawelsadlo committed Sep 14, 2024
commit ee5e159c1796b5ead8eee6c51f6c3901f6b1fc9b
5 changes: 3 additions & 2 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object Deps {
val geny = ivy"com.lihaoyi::geny::1.1.1"
val sourcecode = ivy"com.lihaoyi::sourcecode::0.4.2"
val utest = ivy"com.lihaoyi::utest::0.8.4"
val expecty = ivy"com.eed3si9n.expecty::expecty:0.16.0"
val expecty = ivy"com.eed3si9n.expecty::expecty::0.16.0"
def scalaReflect(scalaVersion: String) = ivy"org.scala-lang:scala-reflect:$scalaVersion"
def scalaLibrary(version: String) = ivy"org.scala-lang:scala-library:${version}"
}
Expand Down Expand Up @@ -97,7 +97,7 @@ trait OsLibModule
)

trait OsLibTestModule extends ScalaModule with TestModule.Utest with SafeDeps {
def ivyDeps = Agg(Deps.utest, Deps.sourcecode,Deps.expecty)
def ivyDeps = Agg(Deps.utest, Deps.sourcecode)
// we check the textual output of system commands and expect it in english
def forkEnv = super.forkEnv() ++ Map(
"LC_ALL" -> "C",
Expand Down Expand Up @@ -165,6 +165,7 @@ object os extends Module {
object jvm extends Cross[OsJvmModule](scalaVersions)
trait OsJvmModule extends OsModule with MiMaChecks {
object test extends ScalaTests with OsLibTestModule {
override def ivyDeps = T{super.ivyDeps() ++ Agg(Deps.expecty)}

// we check the textual output of system commands and expect it in english
def forkEnv = super.forkEnv() ++ Map(
Expand Down
33 changes: 33 additions & 0 deletions os/test/src-jvm/ExpectyIntegration.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package test.os

import os._
import utest._
import com.eed3si9n.expecty.Expecty.expect

object ExpectyIntegration extends TestSuite {
val tests = Tests {
test("Literals") {
test("Basic") {
expect(rel / "src" / "Main/.scala" == rel / "src" / "Main" / ".scala")
expect(root / "core/src/test" == root / "core" / "src" / "test")
expect(root / "core/src/test" == root / "core" / "src/test")
}
test("literals with [..]") {
expect(rel / "src" / ".." == rel / "src" / os.up)
expect(root / "src/.." == root / "src" / os.up)
expect(root / "src" / ".." == root / "src" / os.up)
expect(root / "hello" / ".." / "world" == root / "hello" / os.up / "world")
expect(root / "hello" / "../world" == root / "hello" / os.up / "world")
expect(root / "hello/../world" == root / "hello" / os.up / "world")
}
test("from issue") {
expect(Seq(os.pwd / "foo") == Seq(os.pwd / "foo"))
val path = os.Path("/") / "tmp" / "foo"
expect(path.startsWith(os.Path("/") / "tmp"))
}
test("multiple args") {
expect(rel / "src" / ".." == rel / "src" / os.up, root / "src/.." == root / "src" / os.up)
}
}
}
}
11 changes: 0 additions & 11 deletions os/test/src/PathTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import java.io.File
import os._
import os.Path.driveRoot
import utest.{assert => _, _}
import com.eed3si9n.expecty.Expecty.expect

import java.net.URI
object PathTests extends TestSuite {
Expand All @@ -17,21 +16,11 @@ object PathTests extends TestSuite {
val tests = Tests {
test("Literals") {
test("Basic") {
expect(rel / "src" / "Main/.scala" == rel / "src" / "Main" / ".scala")
expect(root / "core/src/test" == root / "core" / "src" / "test")
expect(root / "core/src/test" == root / "core" / "src/test")

assert(rel / "src" / "Main/.scala" == rel / "src" / "Main" / ".scala")
assert(root / "core/src/test" == root / "core" / "src" / "test")
assert(root / "core/src/test" == root / "core" / "src/test")
}
test("literals with [..]") {
expect(rel / "src" / ".." == rel / "src" / os.up)
expect(root / "src/.." == root / "src" / os.up)
expect(root / "src" / ".." == root / "src" / os.up)
expect(root / "hello" / ".." / "world" == root / "hello" / os.up / "world")
expect(root / "hello" / "../world" == root / "hello" / os.up / "world")
expect(root / "hello/../world" == root / "hello" / os.up / "world")

assert(rel / "src" / ".." == rel / "src" / os.up)
assert(root / "src/.." == root / "src" / os.up)
Expand Down