blob: e471e8c4a559e0a2001c27817421ab905575269c (
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 net.usebox.gemini.server.URIUtils._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
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)
}
}
|