
Raymond Toy pushed to branch issue-401-file-position-setter-wrong at cmucl / cmucl Commits: e7f7a9aa by Raymond Toy at 2025-05-08T07:57:10-07:00 Add tests for file-position - - - - - 1 changed file: - tests/fd-streams.lisp Changes: ===================================== tests/fd-streams.lisp ===================================== @@ -34,3 +34,34 @@ (setf s (open *test-file*)) (file-length s)) (delete-file *test-file*)))) + +(define-test file-position.1 + (:tag :issues) + ;; Create a short test file + (let ((test-file (merge-pathnames #p"file-pos.txt" *test-path*))) + (with-open-file (s test-file + :direction :output + :if-exists :supersede) + (write-string "aaaaaa" s) + (write-char #\newline s)) + (with-open-file (s test-file) + (read-line s) + (assert-true (file-position s 0)) + (assert-equal (file-position s) 0)))) + +(define-test file-position.2 + (:tag :issues) + ;; Create a test file just longer than the internal in-buffer length + ;; and the first line is more than 512 characters long. + (let ((test-file (merge-pathnames #p"file-pos.txt" *test-path*))) + (with-open-file (s test-file + :direction :output + :if-exists :supersede) + (write-string (make-string 512 :initial-element #\a) s) + (write-char #\newline s) + (write-string "zzzzz" s) + (write-char #\newline s)) + (with-open-file (s test-file) + (read-line s) + (assert-true (file-position s 0)) + (assert-equal (file-position s) 0)))) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/e7f7a9aad8981e3baf90492b... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/e7f7a9aad8981e3baf90492b... You're receiving this email because of your account on gitlab.common-lisp.net.