Skip to content

Commit a121174

Browse files
committed
Fix: truncating to empty files failed
Also don't resume from defaultAction which is forbidden by the Smalltalk ANSI standard.
1 parent 95992a6 commit a121174

File tree

10 files changed

+30
-6
lines changed

10 files changed

+30
-6
lines changed

src/FS-Core.package/FSResolutionRequest.class/instance/defaultAction.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ defaultAction
33
| filedir ref |
44
filedir := UIManager default chooseDirectory: 'Where is ', origin, '?'.
55
ref := filedir ifNotNil: [FileSystem disk referenceTo: filedir fullName].
6-
self resume: ref
6+
^ ref

src/FS-Core.package/FSResolutionRequest.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"class" : {
33
"for:" : "cwp 10/27/2009 10:13" },
44
"instance" : {
5-
"defaultAction" : "jr 3/2/2017 17:38",
5+
"defaultAction" : "jr 3/6/2019 20:12",
66
"origin:" : "cwp 10/27/2009 10:22" } }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
public
22
truncateTo: anInteger
3-
Primitives setPosition: id to: anInteger - 1.
3+
Primitives setPosition: id to: (anInteger - 1 clampLow: 0).
44
Primitives truncate: id to: anInteger.
55
self reopen

src/FS-Disk.package/FSFileHandle.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
"registerForFinalization" : "jr 4/17/2017 16:34",
1515
"size" : "cwp 7/22/2009 07:44",
1616
"startUp" : "cwp 11/20/2009 16:48",
17-
"truncateTo:" : "jr 10/1/2017 17:27" } }
17+
"truncateTo:" : "jr 6/15/2020 00:35" } }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
SquotTrackedObjectMetadata {
22
#objectClassName : #PackageInfo,
33
#serializer : #SquotCypressCodeSerializer
44
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
tests
2+
testTruncateEmpty
3+
stream
4+
nextPutAll: #(42 43 44 45 46);
5+
flush;
6+
position: 0;
7+
truncate.
8+
self assert: self contents isEmpty.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tests
2+
testTruncateToEmpty
3+
stream nextPutAll: #(42 43 44 45 46).
4+
stream flush.
5+
stream truncateTo: 0.
6+
self assert: self contents isEmpty.

src/FS-Tests-AnsiStreams.package/FSWriteStreamTest.class/methodProperties.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
"testTab" : "cwp 7/29/2009 21:56",
2121
"testTabRepeat" : "CamilloBruni 8/12/2011 14:40",
2222
"testTruncate" : "jr 4/13/2017 15:47",
23-
"testTruncateTo" : "cwp 10/15/2009 21:50" } }
23+
"testTruncateEmpty" : "jr 6/15/2020 00:29",
24+
"testTruncateTo" : "cwp 10/15/2009 21:50",
25+
"testTruncateToEmpty" : "jr 6/15/2020 00:30" } }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tests
2+
testTruncateEmpty
3+
| out |
4+
out := #(1 2 3 4 5) asByteArray.
5+
handle at: 1 write: out startingAt: 1 count: 5.
6+
handle truncateTo: 0.
7+
self assert: 0 equals: handle size

src/FS-Tests-Core.package/FSHandleTest.class/methodProperties.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
"testSizeAfterGrow" : "cwp 7/29/2009 22:11",
2020
"testSizeNoGrow" : "cwp 7/29/2009 22:13",
2121
"testTruncate" : "jr 10/1/2017 02:23",
22+
"testTruncateEmpty" : "jr 6/15/2020 00:30",
2223
"testWriteStream" : "cwp 7/28/2009 22:40" } }

0 commit comments

Comments
 (0)