mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-22 04:21:16 -08:00
file-string-length: revert behavior change for string-output-stream.
We signal an error if the stream is not a file stream (like before). We provide note in the tests that this is an undefined behavior.
This commit is contained in:
parent
30c4120b15
commit
b22dcd5e3e
2 changed files with 6 additions and 6 deletions
|
|
@ -4812,8 +4812,7 @@ cl_file_string_length(cl_object stream, cl_object string)
|
|||
}
|
||||
}
|
||||
unlikely_if (!ECL_FILE_STREAM_P(stream)) {
|
||||
/* Spec says, that if cannot be determined we return NIL. */
|
||||
return ECL_NIL;
|
||||
not_a_file_stream(stream);
|
||||
}
|
||||
switch (ecl_t_of(string)) {
|
||||
#ifdef ECL_UNICODE
|
||||
|
|
|
|||
|
|
@ -98,14 +98,15 @@
|
|||
(finishes (file-length broadcast))
|
||||
(finishes (file-string-length broadcast "jd"))))))
|
||||
|
||||
;;; FILE-STRING-LENGTH should work on all streams and if can't be determined -
|
||||
;;; return NIL.
|
||||
(test ansi.21-2.file-string-length=nil
|
||||
(let ((stream (make-string-output-stream)))
|
||||
(finishes (file-position stream))
|
||||
(signals error (file-length stream))
|
||||
;; this should either return NIL or a number > 0.
|
||||
(finishes (file-string-length stream "jd"))))
|
||||
;; Undefined behavior, should either signal error (because stream is not
|
||||
;; file output character stream), return NIL (because can't be determined)
|
||||
;; or return integer (because progress can be determined).
|
||||
#+ (or) (signals error (file-string-length stream "jd"))
|
||||
#+ (or) (is (typep (file-string-length stream "jd") '(or null integer)))))
|
||||
|
||||
;;; file-* should be passed to the /last/ component.
|
||||
(test ansi.21-2.last-component
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue