blob: ab00c86645f2359d6837deacfad259731eec5b7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package net.usebox.gemini.server
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
import URIUtils._
class URIUtilsSpec extends AnyFlatSpec with Matchers {
behavior of "validPath"
it should "return true for the emtpy path" in {
"".isValidPath shouldBe true
}
it should "return true for valid paths" in {
List("/", "/file", "/./", "/.", "/dir/", "/dir/../").foreach(
_.isValidPath shouldBe true
)
}
it should "return false for invalid paths" in {
List("/../", "/..", "/dir/../..", "/dir/../..", "/./../", "/./dir/.././../")
.foreach(_.isValidPath shouldBe false)
}
}
|