aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/webdav/webdav-resource.scm
blob: 73a434be6a86ac963ce61012eaeeaaaf7cf0e5e7 (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
30
31
(define-module (test webdav-resource)
  :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") '())))

'((calp webdav resource base))