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