aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/util/test-util.scm
blob: d5853c955666c42375417cb9921aec21d7ee6c44 (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
38
39
40
41
42
43
44
45
(define-module (test test-util)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-64 test-error)
  :use-module (srfi srfi-88)
  :use-module (hnh test util))

(test-equal "µs" #e2e6 (µs 2))

(test-equal "transform-time-of-day"
  1698494486139313
  (transform-time-of-day
   ;; As returned by (gettimeofday)
   '(1698494486 . 139313)))

;; green
;; red
;; yellow
;; bold
;; make-indent

(test-equal "Indent"
  "        "
  (make-indent 4))

(test-equal "" (string-replace-head "" ""))
(test-equal "H" (string-replace-head "" "H"))
(test-equal "TAIL" (string-replace-head "TAIL" ""))
(test-equal "HAIL" (string-replace-head "TAIL" "H"))


;;; This is far from perfect
(test-assert "Is some form of diff produced"
  (string?
              (diff
               "This is the
first
string.
"
               "This is the
second
string.
")))


'((hnh test util))