-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from eatkins/swoval-update
Don't automatically add path on error
- Loading branch information
Showing
4 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package sbt.io | ||
|
||
import java.nio.file._ | ||
import org.scalatest.FlatSpec | ||
import sbt.io.FileTreeView.AllPass | ||
|
||
class FileTreeViewSpec extends FlatSpec { | ||
val view = FileTreeView.DEFAULT | ||
"FileTreeView" should "return the source root with depth == -1" in IO.withTemporaryDirectory { | ||
dir => | ||
assert(view.list(dir.toPath, -1, AllPass).map(_.toPath) == Seq(dir.toPath)) | ||
} | ||
"FileTreeView" should "not return the source root with depth >= 0" in IO.withTemporaryDirectory { | ||
dir => | ||
assert(view.list(dir.toPath, 0, AllPass).isEmpty) | ||
assert(view.list(dir.toPath, 10, AllPass).isEmpty) | ||
} | ||
"FileTreeView" should "get recursive files" in IO.withTemporaryDirectory { dir => | ||
val subdir = Files.createDirectory(dir.toPath.resolve("subdir")) | ||
val nestedSubdir = Files.createDirectory(subdir.resolve("nested-subdir")) | ||
val file = Files.createFile(nestedSubdir.resolve("file")) | ||
assert(view.list(dir.toPath, 3, (_: TypedPath).toPath == file).map(_.toPath) == Seq(file)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters