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

tests: fix tests on Linux /w tmpfs #111

Merged
merged 1 commit into from
Feb 13, 2017
Merged
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
20 changes: 11 additions & 9 deletions core/src/test/scala/better/files/FileSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ class FileSpec extends FlatSpec with BeforeAndAfterEach with Matchers {
}

it should "glob" in {
a1.glob("**/*.txt").map(_.name).toSeq shouldEqual Seq("t1.txt", "t2.txt")
a1.glob("**/*.txt").map(_.name).toSeq.sorted shouldEqual Seq("t1.txt", "t2.txt")
//a1.glob("*.txt").map(_.name).toSeq shouldEqual Seq("t1.txt", "t2.txt")
testRoot.glob("**/*.txt").map(_.name).toSeq shouldEqual Seq("t1.txt", "t2.txt")
testRoot.glob("**/*.txt").map(_.name).toSeq.sorted shouldEqual Seq("t1.txt", "t2.txt")
val path = testRoot.path.toString.ensuring(testRoot.path.isAbsolute)
File(path).glob("**/*.{txt}").map(_.name).toSeq shouldEqual Seq("t1.txt", "t2.txt")
("benchmarks"/"src").glob("**/*.{scala,java}").map(_.name).toSeq shouldEqual Seq("ArrayBufferScanner.java", "Scanners.scala", "ScannerBenchmark.scala")
("benchmarks"/"src").glob("**/*.{scala}").map(_.name).toSeq shouldEqual Seq("Scanners.scala", "ScannerBenchmark.scala")
("benchmarks"/"src").glob("**/*.scala").map(_.name).toSeq shouldEqual Seq("Scanners.scala", "ScannerBenchmark.scala")
("benchmarks"/"src").listRecursively.filter(_.extension.contains(".scala")).map(_.name).toSeq shouldEqual Seq("Scanners.scala", "ScannerBenchmark.scala")
File(path).glob("**/*.{txt}").map(_.name).toSeq.sorted shouldEqual Seq("t1.txt", "t2.txt")
("benchmarks"/"src").glob("**/*.{scala,java}").map(_.name).toSeq.sorted shouldEqual Seq("ArrayBufferScanner.java", "ScannerBenchmark.scala", "Scanners.scala")
("benchmarks"/"src").glob("**/*.{scala}").map(_.name).toSeq.sorted shouldEqual Seq("ScannerBenchmark.scala", "Scanners.scala")
("benchmarks"/"src").glob("**/*.scala").map(_.name).toSeq.sorted shouldEqual Seq("ScannerBenchmark.scala", "Scanners.scala")
("benchmarks"/"src").listRecursively.filter(_.extension.contains(".scala")).map(_.name).toSeq.sorted shouldEqual Seq("ScannerBenchmark.scala", "Scanners.scala")
ls("core"/"src"/"test") should have length 1
("core"/"src"/"test").walk(maxDepth = 1) should have length 2
("core"/"src"/"test").walk(maxDepth = 0) should have length 1
Expand Down Expand Up @@ -178,8 +178,10 @@ class FileSpec extends FlatSpec with BeforeAndAfterEach with Matchers {
it should "support sorting" in {
testRoot.list.toSeq.sorted(File.Order.byName) should not be empty
testRoot.list.toSeq.max(File.Order.bySize).isEmpty shouldBe false
testRoot.list.toSeq.min(File.Order.byDepth).isEmpty shouldBe false
testRoot.list.toSeq.min(File.Order.byModificationTime).isEmpty shouldBe false
List(fa, fb).contains(testRoot.list.toSeq.min(File.Order.byDepth)) shouldBe true
Thread.sleep(1000)
t2.appendLine("modified!")
a1.list.toSeq.min(File.Order.byModificationTime) shouldBe t1
testRoot.list.toSeq.sorted(File.Order.byDirectoriesFirst) should not be empty
}

Expand Down