1 | "{ Encoding: utf8 }" !
|
---|
2 | !WorkspaceApplicationTests methodsFor:'tests'!
|
---|
3 |
|
---|
4 | test_issue229
|
---|
5 | "
|
---|
6 | Test saving file with same name as directory
|
---|
7 | 1. Create a random directory in the user's home directory
|
---|
8 | 2. Write a random file into testing subdirectory
|
---|
9 | 2. Save the Workspace
|
---|
10 | 3. The original subdirectory/file is unavailable (subdirectory renamed as .bak)
|
---|
11 |
|
---|
12 | Check that warning message is shown or simply changes to the destination directory if directory
|
---|
13 | "
|
---|
14 | | randomDirectoryName randomDirectoryPath pathToTest testFileInSubdirectory |
|
---|
15 |
|
---|
16 | randomDirectoryName := Random new nextLettersOrDigits: 86.
|
---|
17 | randomDirectoryPath := Filename homeDirectory asString, '\', randomDirectoryName asString.
|
---|
18 |
|
---|
19 | pathToTest := (randomDirectoryPath, '\', 'testing') asFilename.
|
---|
20 | pathToTest recursiveMakeDirectory.
|
---|
21 |
|
---|
22 | testFileInSubdirectory := Filename newTemporaryIn: (pathToTest).
|
---|
23 | testFileInSubdirectory writingFileDo: [ :stream | stream nextPutLine: 'This file should not be lost!!' ].
|
---|
24 |
|
---|
25 | [
|
---|
26 | textView contents: 'Directory vs. filename naming collision.'.
|
---|
27 | textViewInteractor type: #Ctrls.
|
---|
28 | textViewInteractor type: #ShiftHome.
|
---|
29 | textView setClipboardText: pathToTest asString.
|
---|
30 |
|
---|
31 | textViewInteractor type: #Paste.
|
---|
32 | textViewInteractor type: #Return.
|
---|
33 |
|
---|
34 | self assert: pathToTest directoryContents notEmpty
|
---|
35 |
|
---|
36 | ] ensure: [
|
---|
37 | ObjectMemory garbageCollect.
|
---|
38 | randomDirectoryPath asFilename recursiveRemove
|
---|
39 | ]
|
---|
40 |
|
---|
41 | "Created: / 15-10-2018 / 09:40:47 / svestkap"
|
---|
42 | "Modified (comment): / 15-10-2018 / 13:05:34 / svestkap"
|
---|
43 | ! !
|
---|
44 |
|
---|