| ... |
... |
@@ -103,78 +103,24 @@ |
|
103
|
103
|
(assert-equal '(:absolute "TMP" "Foo" "bar")
|
|
104
|
104
|
(pathname-directory "/tmp/Foo/BAR/" :case :common)))
|
|
105
|
105
|
|
|
106
|
|
-#+nil
|
|
107
|
106
|
(define-test trac.36
|
|
108
|
|
- (:tag :trac)
|
|
109
|
|
- (let ((path "/tmp/trac.36.bom.txt"))
|
|
110
|
|
- (flet ((bug (&optional (format :utf16))
|
|
|
107
|
+ (:tag :trac)
|
|
|
108
|
+ (flet ((bug (&optional (format :utf16))
|
|
|
109
|
+ (ext:with-temporary-file (path)
|
|
111
|
110
|
(with-open-file (s path
|
|
112
|
111
|
:direction :output
|
|
113
|
|
- :if-exists :supersede
|
|
114
|
112
|
:external-format format)
|
|
115
|
113
|
(format s "Hello~%"))
|
|
116
|
114
|
(with-open-file (s path
|
|
117
|
115
|
:direction :input
|
|
118
|
116
|
:external-format format)
|
|
119
|
117
|
(let ((ch (read-char s)))
|
|
120
|
|
- (values ch (file-position s))))))
|
|
121
|
|
- (assert-equal (values #\H 4)
|
|
122
|
|
- (bug :utf16))
|
|
123
|
|
- (assert-equal (values #\H 8)
|
|
124
|
|
- (bug :utf32)))))
|
|
125
|
|
-
|
|
126
|
|
-#+nil
|
|
127
|
|
-(define-test trac.36
|
|
128
|
|
- (:tag :trac)
|
|
129
|
|
- (flet ((bug (&optional (format :utf16))
|
|
130
|
|
- (ext:with-temporary-stream (s :direction :io :external-format format)
|
|
131
|
|
- (format s "Hello~%")
|
|
132
|
|
- (file-position s 0)
|
|
133
|
|
- (let ((ch (read-char s)))
|
|
134
|
|
- (values ch (file-position s))))))
|
|
|
118
|
+ (values ch (file-position s)))))))
|
|
135
|
119
|
(assert-equal (values #\H 4)
|
|
136
|
120
|
(bug :utf16))
|
|
137
|
121
|
(assert-equal (values #\H 8)
|
|
138
|
122
|
(bug :utf32))))
|
|
139
|
123
|
|
|
140
|
|
-(define-test trac.36
|
|
141
|
|
- (:tag :trac)
|
|
142
|
|
- (flet ((bug (&optional (format :utf16))
|
|
143
|
|
- (ext:with-temporary-file (path)
|
|
144
|
|
- (with-open-file (s path
|
|
145
|
|
- :direction :output
|
|
146
|
|
- :external-format format)
|
|
147
|
|
- (format s "Hello~%"))
|
|
148
|
|
- (with-open-file (s path
|
|
149
|
|
- :direction :input
|
|
150
|
|
- :external-format format)
|
|
151
|
|
- (let ((ch (read-char s)))
|
|
152
|
|
- (values ch (file-position s)))))))
|
|
153
|
|
- (assert-equal (values #\H 4)
|
|
154
|
|
- (bug :utf16))
|
|
155
|
|
- (assert-equal (values #\H 8)
|
|
156
|
|
- (bug :utf32)))))
|
|
157
|
|
-
|
|
158
|
|
-#+nil
|
|
159
|
|
-(define-test trac.43
|
|
160
|
|
- (:tag :trac)
|
|
161
|
|
- (assert-true
|
|
162
|
|
- (let ((path "/tmp/trac.43.txt"))
|
|
163
|
|
- (unwind-protect
|
|
164
|
|
- (progn
|
|
165
|
|
- (with-open-file (ostream path :direction :output
|
|
166
|
|
- :external-format :utf-8)
|
|
167
|
|
- (dotimes (i 1000)
|
|
168
|
|
- (write-char (code-char #x1234) ostream)))
|
|
169
|
|
-
|
|
170
|
|
- (with-open-file (stream path :direction :input
|
|
171
|
|
- :external-format :utf-8)
|
|
172
|
|
- (let ((p0 (file-position stream))
|
|
173
|
|
- (ch (read-char stream)))
|
|
174
|
|
- (unread-char ch stream)
|
|
175
|
|
- (let ((p0* (file-position stream)))
|
|
176
|
|
- (eql p0* p0)))))))))
|
|
177
|
|
-
|
|
178
|
124
|
(define-test trac.43
|
|
179
|
125
|
(:tag :trac)
|
|
180
|
126
|
(assert-true
|
| ... |
... |
@@ -197,26 +143,6 @@ |
|
197
|
143
|
(assert-equal "#P(:DIRECTORY (:ABSOLUTE \"tmp\" \"\" \"a\" \"\" \"b\"))"
|
|
198
|
144
|
(princ-to-string (make-pathname :directory '(:absolute "tmp" "" "a" "" "b")))))
|
|
199
|
145
|
|
|
200
|
|
-#+nil
|
|
201
|
|
-(define-test trac.58
|
|
202
|
|
- (:tag :trac)
|
|
203
|
|
- (assert-false
|
|
204
|
|
- (let ((path "/tmp/trac.58.txt")
|
|
205
|
|
- failures)
|
|
206
|
|
- (unwind-protect
|
|
207
|
|
- (progn
|
|
208
|
|
- (with-open-file (s path :direction :output :external-format :utf-16)
|
|
209
|
|
- (dotimes (i 300)
|
|
210
|
|
- (write-char (code-char i) s)))
|
|
211
|
|
-
|
|
212
|
|
- (with-open-file (s path :direction :input :external-format :utf-16)
|
|
213
|
|
- (dotimes (i 300)
|
|
214
|
|
- (let ((ch (read-char s nil nil)))
|
|
215
|
|
- (unless (= i (char-code ch))
|
|
216
|
|
- (push (list i ch (char-code ch)) failures)))))
|
|
217
|
|
- failures)
|
|
218
|
|
- (delete-file path)))))
|
|
219
|
|
-
|
|
220
|
146
|
(define-test trac.58
|
|
221
|
147
|
(:tag :trac)
|
|
222
|
148
|
(assert-false
|
| ... |
... |
@@ -318,26 +244,6 @@ |
|
318
|
244
|
(assert-equal "A1234AAAA"
|
|
319
|
245
|
(subseq (trac.70-test *trac.70* "a12345") 0 9)))
|
|
320
|
246
|
|
|
321
|
|
-#+nil
|
|
322
|
|
-(define-test trac.79
|
|
323
|
|
- (:tag :trac)
|
|
324
|
|
- ;; Create a temp file full of latin1 characters.
|
|
325
|
|
- (assert-equal
|
|
326
|
|
- '(0 1)
|
|
327
|
|
- (let ((path "/tmp/trac.70.txt"))
|
|
328
|
|
- (unwind-protect
|
|
329
|
|
- (progn
|
|
330
|
|
- (with-open-file (s path :direction :output :if-exists :supersede
|
|
331
|
|
- :external-format :latin1)
|
|
332
|
|
- (dotimes (k 255)
|
|
333
|
|
- (write-char (code-char k) s)))
|
|
334
|
|
- (with-open-file (s path :direction :input :external-format :latin1)
|
|
335
|
|
- (list (file-position s)
|
|
336
|
|
- (progn
|
|
337
|
|
- (read-char s)
|
|
338
|
|
- (file-position s)))))
|
|
339
|
|
- (delete-file path)))))
|
|
340
|
|
-
|
|
341
|
247
|
(define-test trac.79
|
|
342
|
248
|
(:tag :trac)
|
|
343
|
249
|
;; Create a temp file full of latin1 characters.
|
| ... |
... |
@@ -360,30 +266,6 @@ |
|
360
|
266
|
(assert-true (ignore-errors (format nil "~ve" 21 5d-234)))
|
|
361
|
267
|
(assert-true (ignore-errors (format nil "~ve" 100 5d-234))))
|
|
362
|
268
|
|
|
363
|
|
-#+nil
|
|
364
|
|
-(define-test trac.87.output
|
|
365
|
|
- (:tag :trac)
|
|
366
|
|
- ;; Test that run-program accepts :element-type and produces the
|
|
367
|
|
- ;; correct output.
|
|
368
|
|
- (let ((path "/tmp/trac.87.output")
|
|
369
|
|
- (string "Hello"))
|
|
370
|
|
- (unwind-protect
|
|
371
|
|
- (progn
|
|
372
|
|
- (with-open-file (s path :direction :output :if-exists :supersede
|
|
373
|
|
- :external-format :latin1)
|
|
374
|
|
- (write-string string s))
|
|
375
|
|
- (let* ((expected (stream:string-to-octets string :external-format :latin1))
|
|
376
|
|
- (octets (make-array (length expected)
|
|
377
|
|
- :element-type '(unsigned-byte 8)))
|
|
378
|
|
- (proc (ext:run-program "/bin/cat" (list path)
|
|
379
|
|
- :output :stream
|
|
380
|
|
- :element-type '(unsigned-byte 8))))
|
|
381
|
|
- (read-sequence octets (ext:process-output proc))
|
|
382
|
|
- (assert-equalp
|
|
383
|
|
- expected
|
|
384
|
|
- octets)))
|
|
385
|
|
- (delete-file path))))
|
|
386
|
|
-
|
|
387
|
269
|
(define-test trac.87.output
|
|
388
|
270
|
(:tag :trac)
|
|
389
|
271
|
;; Test that run-program accepts :element-type and produces the
|
| ... |
... |
@@ -404,32 +286,6 @@ |
|
404
|
286
|
expected
|
|
405
|
287
|
octets)))))
|
|
406
|
288
|
|
|
407
|
|
-#+nil
|
|
408
|
|
-(define-test trac.87.input
|
|
409
|
|
- (:tag :trac)
|
|
410
|
|
- ;; Test that run-program accepts :element-type and produces the
|
|
411
|
|
- ;; correct input (and output).
|
|
412
|
|
- (let ((path "/tmp/trac.87.input")
|
|
413
|
|
- (string "Hello"))
|
|
414
|
|
- (unwind-protect
|
|
415
|
|
- (progn
|
|
416
|
|
- (with-open-file (s path :direction :output :if-exists :supersede
|
|
417
|
|
- :external-format :latin1)
|
|
418
|
|
- (write-string string s))
|
|
419
|
|
- (let ((octets (stream:string-to-octets string :external-format :latin1))
|
|
420
|
|
- (output (make-array (length string)
|
|
421
|
|
- :element-type '(unsigned-byte 8)))
|
|
422
|
|
- (proc (ext:run-program "/bin/cat" (list path)
|
|
423
|
|
- :input :stream
|
|
424
|
|
- :output :stream
|
|
425
|
|
- :element-type '(unsigned-byte 8))))
|
|
426
|
|
- (write-sequence octets (ext:process-input proc))
|
|
427
|
|
- (read-sequence output (ext:process-output proc))
|
|
428
|
|
- (assert-equalp
|
|
429
|
|
- octets
|
|
430
|
|
- output)))
|
|
431
|
|
- (delete-file path))))
|
|
432
|
|
-
|
|
433
|
289
|
(define-test trac.87.input
|
|
434
|
290
|
(:tag :trac)
|
|
435
|
291
|
;; Test that run-program accepts :element-type and produces the
|
| ... |
... |
@@ -510,24 +366,6 @@ |
|
510
|
366
|
;; Not quite what ticket 101 is about, but it came up in investigating
|
|
511
|
367
|
;; CLEAR-OUTPUT on a Gray stream. Verify CLEAR-OUTPUT actually
|
|
512
|
368
|
;; does. Previously, it did nothing.
|
|
513
|
|
-#+nil
|
|
514
|
|
-(define-test trac.101
|
|
515
|
|
- (:tag :trac)
|
|
516
|
|
- (assert-eql
|
|
517
|
|
- 0
|
|
518
|
|
- (let ((s (open *test-file*
|
|
519
|
|
- :direction :output
|
|
520
|
|
- :if-exists :supersede)))
|
|
521
|
|
- (unwind-protect
|
|
522
|
|
- (progn
|
|
523
|
|
- (write-char #\a s)
|
|
524
|
|
- (clear-output s)
|
|
525
|
|
- (close s)
|
|
526
|
|
- (setf s (open *test-file*))
|
|
527
|
|
- (file-length s))
|
|
528
|
|
- (close s)
|
|
529
|
|
- (delete-file *test-file*)))))
|
|
530
|
|
-
|
|
531
|
369
|
(define-test trac.101
|
|
532
|
370
|
(:tag :trac)
|
|
533
|
371
|
(assert-eql
|