Skip to content

Commit

Permalink
Test unique name of two generated temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Feb 4, 2024
1 parent f7d355f commit f20c01f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
tests-files
testNewTemporaryFile

| temporaryFile |
| temporaryFile1 temporaryFile2 |
[
temporaryFile := GRPlatform current newTemporaryFile.
temporaryFile1 := GRPlatform current newTemporaryFile.
temporaryFile2 := GRPlatform current newTemporaryFile.
GRPlatform current
writeFileStreamOn: temporaryFile
writeFileStreamOn: temporaryFile1
do: [ :str | str nextPutAll: 'test temporary' ]
binary: false.
self assert: (GRPlatform current fileExists: temporaryFile)
] ensure: [ GRPlatform current deleteFile: temporaryFile ].
self deny: (GRPlatform current fileExists: temporaryFile)
GRPlatform current
writeFileStreamOn: temporaryFile2
do: [ :str | str nextPutAll: #[116 101 115 116 32 116 101 109 112 111 114 97 114 121] ]
binary: true.
self assert: (GRPlatform current fileExists: temporaryFile1).
self deny: (GRPlatform current localNameOf: temporaryFile1) equals: (GRPlatform current localNameOf: temporaryFile2)
] ensure: [ GRPlatform current deleteFile: temporaryFile1. GRPlatform current deleteFile: temporaryFile2 ].
self deny: (GRPlatform current fileExists: temporaryFile1).
self deny: (GRPlatform current fileExists: temporaryFile2)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Grease-Tests-Core'!
self packageOrganizer ensurePackage: #'Grease-Tests-Core' withTags: #()!

0 comments on commit f20c01f

Please sign in to comment.