From 4684c9cacc1c740d908510e327946b2d7bcff8a0 Mon Sep 17 00:00:00 2001 From: erg Date: Wed, 26 Mar 2008 19:40:40 -0500 Subject: [PATCH] work on normalize-pathname add two failing unit tests --- core/io/backend/backend.factor | 2 -- core/io/files/files-tests.factor | 17 +++++++++++++++-- core/io/files/files.factor | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 1595ecd576..8cfcbb71de 100755 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -21,8 +21,6 @@ M: object normalize-directory ; HOOK: normalize-pathname io-backend ( str -- newstr ) -M: object normalize-pathname ; - : set-io-backend ( io-backend -- ) io-backend set-global init-io init-stdio ; diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor index 36b32ea34c..51bf79e29c 100755 --- a/core/io/files/files-tests.factor +++ b/core/io/files/files-tests.factor @@ -1,6 +1,7 @@ IN: io.files.tests -USING: tools.test io.files io threads kernel continuations io.encodings.ascii -io.files.unique sequences strings accessors ; +USING: tools.test io.files io threads kernel continuations +io.encodings.ascii io.files.unique sequences strings accessors +io.encodings.utf8 ; [ ] [ "blahblah" temp-file dup exists? [ delete-directory ] [ drop ] if ] unit-test [ ] [ "blahblah" temp-file make-directory ] unit-test @@ -130,6 +131,18 @@ io.files.unique sequences strings accessors ; [ t ] [ cwd "misc" resource-path [ ] with-directory cwd = ] unit-test +[ t ] [ + temp-directory [ "hi" "test41" utf8 set-file-contents ] with-directory + temp-directory "test41" append-path utf8 file-contents "hi41" = +] unit-test + +[ t ] [ + temp-directory [ + "test43" utf8 [ "hi43" write ] with-stream + ] with-directory + temp-directory "test43" append-path utf8 file-contents "hi43" = +] unit-test + [ ] [ "append-test" temp-file dup exists? [ delete-file ] [ drop ] if ] unit-test [ ] [ "append-test" temp-file ascii dispose ] unit-test diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 6500bdb387..64d8e25ee2 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -272,6 +272,9 @@ DEFER: copy-tree-into : temp-file ( name -- path ) temp-directory prepend-path ; +M: object normalize-pathname ( path -- path' ) + current-directory get prepend-path ; + ! Pathname presentations TUPLE: pathname string ;