-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib-tests.lisp
More file actions
59 lines (48 loc) · 1.89 KB
/
Copy pathlib-tests.lisp
File metadata and controls
59 lines (48 loc) · 1.89 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(use-package :fiveam)
(def-suite* lib-tests)
(def-suite* lib-tests-string
:in lib-tests)
(test concatenates-on-same-line
(is (string-equal (concatenate-on-same-line "a" "b")
"ab")
"two strings are concatenated without a delimiter")
(is (string-equal (concatenate-on-same-line "a" nil)
"a")
"the only argument is returned"))
(test concatenates-by-spaces
(is (string-equal (concatenate-by-spaces "a" "b")
"a b")
"two strings are concatenated with a space as a delimiter")
(is (string-equal (concatenate-by-spaces "a" nil)
"a ")
"the only argument is returned, followed by a space"))
(test splits-strings
(is (equal (split-string "a,b")
'("a" "b"))
"splits string around comma, as default")
(is (equal (split-string "a:b" ":")
'("a" "b"))
"splits string around a specific separator"))
(def-suite* lib-tests-files
:in lib-tests)
(test reads-files
(labels ((write-to-file (file-path data)
(with-open-file (file-stream file-path
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(write-sequence (write-to-string data)
file-stream))))
(write-to-file "/tmp/crater-db-reader-test-file"
'(1 2 3))
(is (equal (read-from-file "/tmp/crater-db-reader-test-file")
'(1 2 3))
"reads content from file")))
(def-suite* lib-tests-sources
:in lib-tests)
(def-suite* lib-tests-packages
:in lib-tests)
(def-suite* lib-tests-printing
:in lib-tests)
(def-suite* lib-tests-commands
:in lib-tests)