Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
912 B

3 years ago
  1. package wow.doge.mygame
  2. import org.scalatest.funsuite.AnyFunSuite
  3. import cats.effect.{Resource => CResource}
  4. import monix.eval.Task
  5. import scala.concurrent.duration._
  6. class FileWatcherTest extends AnyFunSuite {
  7. test("1") {
  8. import better.files._
  9. import io.methvin.better.files._
  10. val myDir =
  11. File((os.pwd / "assets" / "scripts").toString)
  12. val watcher = new RecursiveFileMonitor(myDir) {
  13. override def onCreate(file: File, count: Int) =
  14. println(s"$file got created")
  15. override def onModify(file: File, count: Int) =
  16. println(s"$file got modified $count times")
  17. override def onDelete(file: File, count: Int) =
  18. println(s"$file got deleted")
  19. }
  20. import monix.execution.Scheduler.Implicits.global
  21. CResource
  22. .make(Task { watcher.start(); watcher })(w => Task(w.stop()))
  23. .use(_ => Task.never)
  24. .runSyncUnsafe(10.seconds)
  25. }
  26. }