Raymond Toy pushed to branch issue-139a-default-external-format-utf8 at cmucl / cmucl
Commits:
344b9482 by Raymond Toy at 2022-09-23T15:14:21-07:00
Add test for default external format and system streams
Verify that the default external format is :utf-8 and that all the
system streams use :utf-8.
- - - - -
1 changed file:
- tests/issues.lisp
Changes:
=====================================
tests/issues.lisp
=====================================
@@ -579,3 +579,20 @@
with user-info = (unix:unix-getpwuid uid)
while user-info
finally (assert-false user-info)))
+
+(define-test issue-139.1
+ (:tag :issues)
+ ;; Verify the value of the default external format and that system streams use :utf-8.
+ (assert-eql :utf-8 stream:*default-external-format*)
+ (assert-eql :utf-8 (stream-external-format sys:*stdin*))
+ (assert-eql :utf-8 (stream-external-format sys:*stdout*))
+ (assert-eql :utf-8 (stream-external-format sys:*stderr*))
+ (assert-eql :utf-8 (stream-external-format sys:*tty*))
+ ;; Check that printing to *standard-output* is correctly encoded.
+ (dribble "test-format.txt")
+ ;; Print a Greek lower-case alpha character
+ (princ #\u+3b1)
+ (dribble)
+ (with-open-file (s "test-format.txt" :direction :input)
+ (let ((c (read-char s)))
+ (assert-equal #\u+3b1 c))))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/344b948245ca3b33154c767…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/344b948245ca3b33154c767…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-135-unix-namestring-dot at cmucl / cmucl
Commits:
777ccaeb by Raymond Toy at 2022-09-20T16:42:52-07:00
Add tests for #135
- - - - -
1 changed file:
- tests/issues.lisp
Changes:
=====================================
tests/issues.lisp
=====================================
@@ -579,3 +579,9 @@
with user-info = (unix:unix-getpwuid uid)
while user-info
finally (assert-false user-info)))
+
+(define-test issue.135
+ (:tag :issues)
+ (assert-equalp "." (ext:unix-namestring "."))
+ (assert-equalp "./abc.txt" (ext:unix-namestring "abc.txt"))
+ (assert-equalp "./abc/def/foo.txt" (ext:unix-namestring "abc/def/foo.txt")))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/777ccaebb94ed0ccbf5e8f0…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/777ccaebb94ed0ccbf5e8f0…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-132-ansi-test-rename-files at cmucl / cmucl
Commits:
2a4c3765 by Raymond Toy at 2022-09-16T13:53:26-07:00
Add two more tests for RENAME-FILE
One tests renaming the directory "dir/orig.dir" to "dir/new.dir"
because we call `(rename-file "orig.dir" "new")` and the old file name
has a pathname-name of "orig" and a pathname-type of "dir" so the new
file name has the missing components filled in to produce "new.dir".
The second test does `(rename-file "orig.dir/" "new")`. The original
file has no name or type, so merging "new" adds nothing and we rename
"orig.dir" to just "new".
- - - - -
38e9d88e by Raymond Toy at 2022-09-16T13:53:56-07:00
Undo change as requested by reviewer
- - - - -
2 changed files:
- .gitlab-ci.yml
- tests/issues.lisp
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -80,7 +80,7 @@ linux:ansi-test:
script:
- cd ansi-test
- make LISP="../dist/bin/lisp -batch -noinit -nositeinit"
- - grep -a 'unexpected \(successes\|failures\)' test.out
+ - grep 'No unexpected \(successes\|failures\)' test.out
linux:benchmark:
stage: benchmark
=====================================
tests/issues.lisp
=====================================
@@ -580,7 +580,7 @@
while user-info
finally (assert-false user-info)))
-(define-test issue.132
+(define-test issue.132.1
(:tag :issues)
;; From a message on cmucl-imp 2008/06/01. If "d1" is a directory,
;; (rename "d1" "d2") should rename the directory "d1" to "d2".
@@ -588,7 +588,7 @@
;; "d1/d2".
;;
;; Create the test directory (that is a subdirectory of "dir").
- (assert (ensure-directories-exist "dir/orig-dir/"))
+ (assert-true (ensure-directories-exist "dir/orig-dir/"))
(let ((*default-pathname-defaults* (merge-pathnames "dir/" (ext:default-directory))))
(multiple-value-bind (defaulted-new-name old-truename new-truename)
;; Rename "dir/orig-dir" to "orig/new-dir".
@@ -599,7 +599,49 @@
(make-pathname :directory '(:relative "new-dir")))))
;; Ensure that the rename worked and that the returned values
;; have the expected values.
- (assert defaulted-new-name)
- (assert (equalp old-truename orig))
- (assert (equalp new-truename new))))))
-
+ (assert-true defaulted-new-name)
+ (assert-equalp old-truename orig)
+ (assert-equalp new-truename new)))))
+
+(define-test issue.132.2
+ (:tag :issues)
+ (assert-true (ensure-directories-exist "dir/orig.dir/"))
+ (let ((*default-pathname-defaults* (merge-pathnames "dir/" (ext:default-directory))))
+ (multiple-value-bind (defaulted-new-name old-truename new-truename)
+ ;; Rename "dir/orig.dir" to "orig/new-dir". Since the
+ ;; original name has a pathname-name of "orig" and a
+ ;; pathname-type of "dir", the new file name is merged to
+ ;; produce a pathname-name of "new" with a pathname-type of
+ ;; "dir".
+ (rename-file "orig.dir" "new")
+ (let ((orig (merge-pathnames
+ (make-pathname :directory '(:relative "orig.dir"))))
+ (new (merge-pathnames
+ (make-pathname :directory '(:relative "new.dir")))))
+ ;; Ensure that the rename worked and that the returned values
+ ;; have the expected values.
+ (assert-true defaulted-new-name)
+ (assert-equalp old-truename orig)
+ (assert-equalp new-truename new)))))
+
+(define-test issue.132.3
+ (:tag :issues)
+ (assert-true (ensure-directories-exist "dir/orig.dir/"))
+ (let ((*default-pathname-defaults* (merge-pathnames "dir/" (ext:default-directory))))
+ (multiple-value-bind (defaulted-new-name old-truename new-truename)
+ ;; Rename "dir/orig.dir/" to "orig/new". Note that the
+ ;; original name is "orig.dir/" which marks a directory so
+ ;; that when we merge the new name with the old to fill in
+ ;; missing components, there are none because the old name is
+ ;; a directory with no pathname-name or pathname-type, so the
+ ;; new name stays the same.
+ (rename-file "orig.dir/" "new")
+ (let ((orig (merge-pathnames
+ (make-pathname :directory '(:relative "orig.dir"))))
+ (new (merge-pathnames
+ (make-pathname :directory '(:relative "new")))))
+ ;; Ensure that the rename worked and that the returned values
+ ;; have the expected values.
+ (assert-true defaulted-new-name)
+ (assert-equalp old-truename orig)
+ (assert-equalp new-truename new)))))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/127d8235e5c2553e359af9…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/127d8235e5c2553e359af9…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-132-ansi-test-rename-files at cmucl / cmucl
Commits:
127d8235 by Raymond Toy at 2022-09-16T12:58:47-07:00
Fix so renaming directories does the expected thing.
To do this, we need to merge the new name with
*default-pathname-defaults* to fill in the directory components if
needed. Then we merge that with the original name to fill any
unfilled components.
Add a test for this where we rename "dir/orig-dir" to "dir/new-dir".
- - - - -
2 changed files:
- src/code/filesys.lisp
- tests/issues.lisp
Changes:
=====================================
src/code/filesys.lisp
=====================================
@@ -940,7 +940,7 @@
;;; Rename-File -- Public
;;;
-(defun rename-file (file new-name)
+(defun rename-file (file new-file-name)
"Rename File to have the specified New-Name. If file is a stream
open to a file, then the associated file is renamed.
@@ -950,7 +950,11 @@
File after it was renamed."
(let* ((original (truename file))
(original-namestring (unix-namestring original t))
- (new-name (merge-pathnames new-name original))
+ ;; First, merge NEW-FILE-NAME with *DEFAULT-PATHNAME-DEFAULTS* to
+ ;; fill in the missing components and then merge again with
+ ;; the FILE to get any missing components from FILE.
+ (new-name (merge-pathnames (merge-pathnames new-file-name)
+ file))
(new-namestring (unix-namestring new-name nil)))
(unless new-namestring
(error 'simple-file-error
@@ -968,7 +972,9 @@
(unix:get-unix-error-msg error))))
(when (streamp file)
(file-name file new-namestring))
- (values new-name original (truename new-name)))))
+ (values new-name
+ original
+ (truename new-name)))))
;;; Delete-File -- Public
;;;
=====================================
tests/issues.lisp
=====================================
@@ -579,3 +579,27 @@
with user-info = (unix:unix-getpwuid uid)
while user-info
finally (assert-false user-info)))
+
+(define-test issue.132
+ (:tag :issues)
+ ;; From a message on cmucl-imp 2008/06/01. If "d1" is a directory,
+ ;; (rename "d1" "d2") should rename the directory "d1" to "d2".
+ ;; Previously that produced an error trying to rename "d1" to
+ ;; "d1/d2".
+ ;;
+ ;; Create the test directory (that is a subdirectory of "dir").
+ (assert (ensure-directories-exist "dir/orig-dir/"))
+ (let ((*default-pathname-defaults* (merge-pathnames "dir/" (ext:default-directory))))
+ (multiple-value-bind (defaulted-new-name old-truename new-truename)
+ ;; Rename "dir/orig-dir" to "orig/new-dir".
+ (rename-file "orig-dir/" "new-dir")
+ (let ((orig (merge-pathnames
+ (make-pathname :directory '(:relative "orig-dir"))))
+ (new (merge-pathnames
+ (make-pathname :directory '(:relative "new-dir")))))
+ ;; Ensure that the rename worked and that the returned values
+ ;; have the expected values.
+ (assert defaulted-new-name)
+ (assert (equalp old-truename orig))
+ (assert (equalp new-truename new))))))
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/127d8235e5c2553e359af9e…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/127d8235e5c2553e359af9e…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-136-ansi-test-ensure-directories-exist.8 at cmucl / cmucl
Commits:
c59de890 by Raymond Toy at 2022-09-10T20:20:54-07:00
Update tests for change in ensure-directories-exist
The tests here assumed that `ensure-directories-exits` would return a
pathname object. But it doesn't anymore; it returns the given
pathspec as is.
- - - - -
1 changed file:
- tests/filesys.lisp
Changes:
=====================================
tests/filesys.lisp
=====================================
@@ -10,7 +10,7 @@
(define-test unix-namestring.1.exists
;; Make sure the desired directories exist.
- (assert-equal #P"/tmp/foo/bar/hello.txt"
+ (assert-equal "/tmp/foo/bar/hello.txt"
(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
(dolist (path '("/tmp/hello.txt"
"/tmp/foo/"
@@ -27,7 +27,7 @@
(define-test unix-namestring.1.non-existent
;; Make sure the desired directories exist.
- (assert-equal #P"/tmp/foo/bar/hello.txt"
+ (assert-equal "/tmp/foo/bar/hello.txt"
(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
;; These paths contain directories that don't exist.
(dolist (path '("/tmp/oops/"
@@ -42,7 +42,7 @@
(define-test unix-namestring.2
;; Make sure the desired directories exist.
- (assert-equal #P"/tmp/foo/bar/hello.txt"
+ (assert-equal "/tmp/foo/bar/hello.txt"
(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
(unwind-protect
(progn
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c59de890d9e63d007d56ac3…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c59de890d9e63d007d56ac3…
You're receiving this email because of your account on gitlab.common-lisp.net.