From 604c6d57a34a936ddb13630b8b1741617d4d1f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20Boury?= Date: Wed, 5 Jun 2024 09:37:53 +0200 Subject: [PATCH 1/3] Added a `reset` method to ZnBufferedWriteStream Added a test for the `reset` method --- .../ZnBufferedWriteStream.class/instance/reset.st | 4 ++++ .../monticello.meta/categories.st | 2 +- .../instance/testWritingReset.st | 14 ++++++++++++++ .../monticello.meta/categories.st | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 repository/Zinc-Character-Encoding-Core.package/ZnBufferedWriteStream.class/instance/reset.st create mode 100644 repository/Zinc-Character-Encoding-Tests.package/ZnBufferedWriteStreamTest.class/instance/testWritingReset.st diff --git a/repository/Zinc-Character-Encoding-Core.package/ZnBufferedWriteStream.class/instance/reset.st b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedWriteStream.class/instance/reset.st new file mode 100644 index 00000000..5054d483 --- /dev/null +++ b/repository/Zinc-Character-Encoding-Core.package/ZnBufferedWriteStream.class/instance/reset.st @@ -0,0 +1,4 @@ +accessing +reset + self flushBuffer. + stream reset \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st index 6bf8768c..f2721d0c 100644 --- a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Zinc-Character-Encoding-Core'! \ No newline at end of file +self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Core' withTags: #()! diff --git a/repository/Zinc-Character-Encoding-Tests.package/ZnBufferedWriteStreamTest.class/instance/testWritingReset.st b/repository/Zinc-Character-Encoding-Tests.package/ZnBufferedWriteStreamTest.class/instance/testWritingReset.st new file mode 100644 index 00000000..6b7179bc --- /dev/null +++ b/repository/Zinc-Character-Encoding-Tests.package/ZnBufferedWriteStreamTest.class/instance/testWritingReset.st @@ -0,0 +1,14 @@ +tests +testWritingReset + + | file writeStream readStream | + file := 'test.txt' asFileReference ensureCreateFile. + + writeStream := file binaryWriteStream. + writeStream nextPutAll: 'pedro'. + writeStream reset. + writeStream nextPutAll: 'pha'. + writeStream close. + + readStream := file readStream. + self assert: readStream contents equals: 'pharo' \ No newline at end of file diff --git a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st index d2931a20..099ac033 100644 --- a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st @@ -1 +1 @@ -SystemOrganization addCategory: #'Zinc-Character-Encoding-Tests'! +self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Tests' withTags: #()! From f052aeb360c36517cd59f6cf2e2edb8882c0d783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20Boury?= <39924046+matburnx@users.noreply.github.com> Date: Wed, 5 Jun 2024 08:01:19 +0000 Subject: [PATCH 2/3] Revert wrong changes --- .../monticello.meta/categories.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st index f2721d0c..2cb3537b 100644 --- a/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Core.package/monticello.meta/categories.st @@ -1 +1 @@ -self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Core' withTags: #()! +SystemOrganization addCategory: #'Zinc-Character-Encoding-Core'! From f598de79b8bae34ad0f9b0eab50a968161e86c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20Boury?= <39924046+matburnx@users.noreply.github.com> Date: Wed, 5 Jun 2024 08:02:23 +0000 Subject: [PATCH 3/3] Revert another wrong change --- .../monticello.meta/categories.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st index 099ac033..d2931a20 100644 --- a/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st +++ b/repository/Zinc-Character-Encoding-Tests.package/monticello.meta/categories.st @@ -1 +1 @@ -self packageOrganizer ensurePackage: #'Zinc-Character-Encoding-Tests' withTags: #()! +SystemOrganization addCategory: #'Zinc-Character-Encoding-Tests'!