summaryrefslogtreecommitdiff
path: root/tests/schemantic/iri.scm
blob: 3b7d44a36a7fc20fbfb062030cb72e0850b9e05c (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
32
33
34
35
36
37
; SPDX-FileCopyrightText: 2020 pukkamustard <pukkamustard@posteo.net>
;
; SPDX-License-Identifier: GPL-3.0-or-later

(define-module (tests schemantic iri)
  #:use-module (schemantic iri)
  #:use-module (web uri)
  #:use-module (srfi srfi-64))

(define-namespace ex "http://example.com/#")

(test-begin "iri")

(test-assert "make-iri from string"
    (iri? (make-iri "http://example.com/")))

(test-assert "value of iri is string"
    (equal? "http://example.com/#"
            (iri-value (make-iri "http://example.com/#"))))

(test-assert "make-iri from uri"
    (iri? (make-iri (string->uri "http://example.com/#"))))

(test-assert "value of iri is string of uri"
  (equal? "http://example.com/#"
          (iri-value (make-iri (string->uri "http://example.com/#")))))

(test-assert "make-iri of iri is an iri"
  (iri? (make-iri (make-iri "http://example.com/"))))

(test-equal "equal? compares values"
    (ex "hi") (make-iri "http://example.com/#hi"))

(test-error "make-iri on integer raises an exception"
            (make-iri 4))

(test-end "iri")