aboutsummaryrefslogtreecommitdiff
path: root/tests/test/webdav-util.scm
blob: 5c89cf6ce74ecce8b6c92ea36bb6fcf8609627c4 (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
27
28
29
(define-module (test webdav-util)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-64 test-error)
  :use-module (srfi srfi-71)
  :use-module (srfi srfi-88)
  :use-module (calp webdav resource base))

(test-group "string->href"
  (test-equal "Root path becomes null"
    '() (string->href "/"))
  (test-equal "Trailing slashes are ignored"
    '("a" "b") (string->href "/a/b/")))

(test-group "href->string"
  (test-equal "Null case becomes root path"
    "/" (href->string '()))
  (test-equal "Trailing slashes are not added"
    "/a/b" (href->string '("a" "b"))))

(test-group "href-relative"
  (test-equal '("a" "b") (href-relative '() '("a" "b")))
  (test-equal '("b") (href-relative '("a") '("a" "b")))
  (test-equal '() (href-relative '("a" "b") '("a" "b")))

  (test-error 'misc-error
    (href-relative '("c") '("a" "b")))

  (test-error 'misc-error
    (href-relative '("c") '())))