summaryrefslogtreecommitdiffstats
path: root/tests/018/getput.tl
blob: ed5a4e5f529ae2bfe7b3afaa72c4cd8b4c97b9da (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
(load "../common")

(defvarl file "getput.data")

(push-after-load (remove-path file))

(file-put-objects file '(1 2.3 (a . b) "foo"))

(test
  (file-get-lines file) ("1" "2.3" "(a . b)" "\"foo\""))

(file-append-objects file '(#(nil)))

(mtest
  (file-get-lines file) ("1" "2.3" "(a . b)" "\"foo\"" "#(nil)")
  (file-get-objects file) (1 2.3 (a . b) "foo" #(nil)))

(mtest
  (read-objects "(a . b) #\\c") ((a . b) #\c)
  (read-objects "(a") :error)

(file-put-string file "(a")

(mtest
  (file-get file) :error
  (file-get-objects file) :error)

(let ((errors (with-out-string-stream (err)
                (ignerr (file-get-objects file : err)))))
  (mtest
    (true (contains "syntax error" errors)) t
    (true (contains "unterminated" errors)) t
    (true (contains ":1" errors)) t))

(mtest
  (map-command-lines "tr '[a-z]' '[A-Z]'" '#"a b c") #"A B C"
  (map-process-lines "tr" '#"[a-z] [A-Z]" '#"a b c") #"A B C"
  (map-command-str "tr '[a-z]' '[A-Z]'" "abc") "ABC"
  (map-process-str "tr" '#"[a-z] [A-Z]" "abc") "ABC"
  (map-command-buf "tr '[a-z]' '[A-Z]'" #b'616263') #b'414243'
  (map-process-buf "tr" '#"[a-z] [A-Z]" #b'616263') #b'414243')