Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ object os extends Module {
}
}

/*object native extends Cross[OsNativeModule](scalaVersions)
object native extends Cross[OsNativeModule](scalaVersions)
trait OsNativeModule extends OsModule with ScalaNativeModule {
def scalaNativeVersion = "0.5.2"
def scalaNativeVersion = "0.5.7"
object test extends ScalaNativeTests with OsLibTestModule {
def nativeLinkStubs = true
}
object nohometest extends ScalaNativeTests with OsLibTestModule
}*/
}

object watch extends Module {
object jvm extends Cross[WatchJvmModule](scalaVersions)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion os/src-native/ResourceApi.scala
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
package os
package os
trait ResourceApi
74 changes: 74 additions & 0 deletions os/test/src-jvm/CheckerJvmTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package test.os

import test.os.TestUtil._
import utest._

object CheckerJvmTests extends TestSuite {

def tests: Tests = Tests {
// restricted directory
val rd = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "restricted"

test("zip") - prepChecker { wd =>
intercept[WriteDenied] {
os.zip(
dest = rd / "zipped.zip",
sources = Seq(
wd / "File.txt",
wd / "folder1"
)
)
}
os.exists(rd / "zipped.zip") ==> false

intercept[ReadDenied] {
os.zip(
dest = wd / "zipped.zip",
sources = Seq(
wd / "File.txt",
rd / "folder1"
)
)
}
os.exists(wd / "zipped.zip") ==> false

val zipFile = os.zip(
wd / "zipped.zip",
Seq(
wd / "File.txt",
wd / "folder1"
)
)

val unzipDir = os.unzip(zipFile, wd / "unzipped")
os.walk(unzipDir).sorted ==> Seq(
unzipDir / "File.txt",
unzipDir / "one.txt"
)
}
test("unzip") - prepChecker { wd =>
val zipFileName = "zipped.zip"
val zipFile: os.Path = os.zip(
dest = wd / zipFileName,
sources = Seq(
wd / "File.txt",
wd / "folder1"
)
)

intercept[WriteDenied] {
os.unzip(
source = zipFile,
dest = rd / "unzipped"
)
}
os.exists(rd / "unzipped") ==> false

val unzipDir = os.unzip(
source = zipFile,
dest = wd / "unzipped"
)
os.walk(unzipDir).length ==> 2
}
}
}
File renamed without changes.
61 changes: 0 additions & 61 deletions os/test/src/CheckerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -476,66 +476,5 @@ object CheckerTests extends TestSuite {
os.read(wd / "File.txt") ==> "I am"
}

test("zip") - prepChecker { wd =>
intercept[WriteDenied] {
os.zip(
dest = rd / "zipped.zip",
sources = Seq(
wd / "File.txt",
wd / "folder1"
)
)
}
os.exists(rd / "zipped.zip") ==> false

intercept[ReadDenied] {
os.zip(
dest = wd / "zipped.zip",
sources = Seq(
wd / "File.txt",
rd / "folder1"
)
)
}
os.exists(wd / "zipped.zip") ==> false

val zipFile = os.zip(
wd / "zipped.zip",
Seq(
wd / "File.txt",
wd / "folder1"
)
)

val unzipDir = os.unzip(zipFile, wd / "unzipped")
os.walk(unzipDir).sorted ==> Seq(
unzipDir / "File.txt",
unzipDir / "one.txt"
)
}
test("unzip") - prepChecker { wd =>
val zipFileName = "zipped.zip"
val zipFile: os.Path = os.zip(
dest = wd / zipFileName,
sources = Seq(
wd / "File.txt",
wd / "folder1"
)
)

intercept[WriteDenied] {
os.unzip(
source = zipFile,
dest = rd / "unzipped"
)
}
os.exists(rd / "unzipped") ==> false

val unzipDir = os.unzip(
source = zipFile,
dest = wd / "unzipped"
)
os.walk(unzipDir).length ==> 2
}
}
}
Loading