author | sr |
Wed, 11 Oct 2017 13:50:11 +0200 | |
changeset 1788 | 8f8f8310e503 |
parent 1787 | 67369aa4a2ca |
child 2156 | 6f444eaf1286 |
permissions | -rw-r--r-- |
1787 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1447 | 3 |
"{ Package: 'stx:goodies/regression' }" |
1259 | 4 |
|
5 |
"{ NameSpace: RegressionTests }" |
|
6 |
||
7 |
TestCase subclass:#DirectoryStreamTest |
|
1787 | 8 |
instanceVariableNames:'testDirName' |
1259 | 9 |
classVariableNames:'' |
10 |
poolDictionaries:'' |
|
11 |
category:'tests-Regression-Streams' |
|
12 |
! |
|
13 |
||
1787 | 14 |
!DirectoryStreamTest class methodsFor:'documentation'! |
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
documentation to be added. |
|
19 |
||
20 |
[author:] |
|
21 |
sr |
|
22 |
||
23 |
[instance variables:] |
|
24 |
||
25 |
[class variables:] |
|
26 |
||
27 |
[see also:] |
|
28 |
||
29 |
" |
|
30 |
! ! |
|
1259 | 31 |
|
32 |
!DirectoryStreamTest methodsFor:'cleanup'! |
|
33 |
||
34 |
tearDown |
|
1447 | 35 |
self testDirName recursiveRemove |
1259 | 36 |
! ! |
37 |
||
38 |
!DirectoryStreamTest methodsFor:'helpers'! |
|
39 |
||
40 |
testDirName |
|
1787 | 41 |
testDirName isNil ifTrue:[ |
42 |
testDirName := UUID genRandomUUID printString asFilename. |
|
43 |
]. |
|
44 |
||
45 |
^ testDirName |
|
1259 | 46 |
! ! |
47 |
||
48 |
!DirectoryStreamTest methodsFor:'tests'! |
|
49 |
||
50 |
test01 |
|
51 |
"basic open for appending." |
|
52 |
||
1260
0b8fafd06650
class: RegressionTests::DirectoryStreamTest
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
53 |
|s dir t| |
1259 | 54 |
|
55 |
dir := self testDirName. |
|
56 |
dir asFilename makeDirectory. |
|
57 |
s := DirectoryStream directoryNamed:dir. |
|
58 |
||
1788 | 59 |
OperatingSystem isMSDOSlike ifTrue:[ |
60 |
"/ skip '.', '..' |
|
61 |
s nextLine; nextLine. |
|
62 |
]. |
|
63 |
||
1259 | 64 |
self assert:s atEnd. |
65 |
self assert:s nextLine isNil. |
|
66 |
||
67 |
s close. |
|
68 |
||
69 |
self assert:dir asFilename directoryContents size == 0. |
|
70 |
||
71 |
(dir asFilename construct:'file1') writingFileDo:[:s | s nextPutAll:'foo']. |
|
72 |
||
73 |
dir := self testDirName. |
|
74 |
dir asFilename makeDirectory. |
|
75 |
s := DirectoryStream directoryNamed:dir. |
|
76 |
||
1788 | 77 |
OperatingSystem isMSDOSlike ifTrue:[ |
78 |
"/ skip '.', '..' |
|
79 |
s nextLine; nextLine. |
|
80 |
]. |
|
81 |
||
1259 | 82 |
self assert:s atEnd not. |
1260
0b8fafd06650
class: RegressionTests::DirectoryStreamTest
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
83 |
self assert:(t := s nextLine) = 'file1'. |
0b8fafd06650
class: RegressionTests::DirectoryStreamTest
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
84 |
self assert:s atEnd. |
1259 | 85 |
self assert:s nextLine isNil. |
86 |
||
87 |
s close. |
|
88 |
||
89 |
self assert:dir asFilename directoryContents size == 1. |
|
90 |
||
91 |
" |
|
92 |
self new test01 |
|
93 |
" |
|
94 |
! ! |
|
95 |
||
96 |
!DirectoryStreamTest class methodsFor:'documentation'! |
|
97 |
||
98 |
version |
|
99 |
^ '$Header$' |
|
100 |
! |
|
101 |
||
102 |
version_CVS |
|
103 |
^ '$Header$' |
|
104 |
! ! |
|
105 |