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