1979
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1980
|
3 |
"
|
|
4 |
MIT License
|
|
5 |
|
|
6 |
Copyright (c) 2016 Nahuel Garbezza
|
|
7 |
|
|
8 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9 |
of this software and associated documentation files (the 'Software'), to deal
|
|
10 |
in the Software without restriction, including without limitation the rights
|
|
11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12 |
copies of the Software, and to permit persons to whom the Software is
|
|
13 |
furnished to do so, subject to the following conditions:
|
|
14 |
|
|
15 |
The above copyright notice and this permission notice shall be included in all
|
|
16 |
copies or substantial portions of the Software.
|
|
17 |
|
|
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24 |
SOFTWARE.
|
|
25 |
"
|
1978
|
26 |
"{ Package: 'stx:goodies/regression' }"
|
|
27 |
|
|
28 |
"{ NameSpace: RegressionTests }"
|
|
29 |
|
|
30 |
TestCase subclass:#IndentStreamTest
|
|
31 |
instanceVariableNames:''
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Kiwi-Tests'
|
|
35 |
!
|
|
36 |
|
1980
|
37 |
!IndentStreamTest class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
|
41 |
MIT License
|
|
42 |
|
|
43 |
Copyright (c) 2016 Nahuel Garbezza
|
|
44 |
|
|
45 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
46 |
of this software and associated documentation files (the 'Software'), to deal
|
|
47 |
in the Software without restriction, including without limitation the rights
|
|
48 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the Software is
|
|
50 |
furnished to do so, subject to the following conditions:
|
|
51 |
|
|
52 |
The above copyright notice and this permission notice shall be included in all
|
|
53 |
copies or substantial portions of the Software.
|
|
54 |
|
|
55 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
56 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
57 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
58 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
59 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
60 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
61 |
SOFTWARE.
|
|
62 |
|
|
63 |
"
|
|
64 |
! !
|
1978
|
65 |
|
1979
|
66 |
!IndentStreamTest methodsFor:'tests'!
|
1978
|
67 |
|
|
68 |
testConstructors
|
|
69 |
|
|
70 |
self assert:(IndentStream with: 'xxx') indentLevel = 0.
|
|
71 |
self assert:(IndentStream on: 'xxx') indentLevel = 0.
|
|
72 |
|
|
73 |
"Modified: / 01-07-2018 / 10:12:07 / Claus Gittinger"
|
|
74 |
!
|
|
75 |
|
1979
|
76 |
testGeneratedOutput
|
|
77 |
| stream |
|
|
78 |
stream := IndentStream on: ''.
|
|
79 |
stream nextPutLine:'line1'.
|
|
80 |
stream indent.
|
|
81 |
stream nextPutLine:'line2a'.
|
|
82 |
stream nextPutLine:'line2b'.
|
|
83 |
stream indent.
|
|
84 |
stream nextPutLine:'line3a'.
|
|
85 |
stream nextPutAll:'line3b'.
|
|
86 |
stream indentBack; cr.
|
|
87 |
stream nextPutLine:'line4a'.
|
|
88 |
stream nextPutAll:'line4b'.
|
|
89 |
stream indentBack; cr.
|
|
90 |
stream nextPutLine:'line5'.
|
|
91 |
self assert:stream contents =
|
|
92 |
'line1
|
|
93 |
\tline2a
|
|
94 |
\tline2b
|
|
95 |
\t\tline3a
|
|
96 |
\t\tline3b
|
|
97 |
\tline4a
|
|
98 |
\tline4b
|
|
99 |
line5
|
|
100 |
' withoutCEscapes
|
|
101 |
|
|
102 |
"Created: / 01-07-2018 / 10:23:56 / Claus Gittinger"
|
|
103 |
!
|
|
104 |
|
1978
|
105 |
testIndent
|
|
106 |
|
|
107 |
| stream |
|
|
108 |
stream := IndentStream on: 'xxx'.
|
|
109 |
stream indent; indent.
|
|
110 |
self assert:(stream indentLevel = 2).
|
|
111 |
|
|
112 |
"Modified: / 01-07-2018 / 10:12:22 / Claus Gittinger"
|
|
113 |
!
|
|
114 |
|
|
115 |
testIndentBack
|
|
116 |
|
|
117 |
| stream |
|
|
118 |
stream := IndentStream on: 'xxx'.
|
|
119 |
stream indent; indent.
|
|
120 |
stream indentBack.
|
|
121 |
self assert:stream indentLevel = 1.
|
|
122 |
|
|
123 |
"Modified: / 01-07-2018 / 10:12:35 / Claus Gittinger"
|
|
124 |
! !
|
|
125 |
|
|
126 |
!IndentStreamTest class methodsFor:'documentation'!
|
|
127 |
|
|
128 |
version
|
|
129 |
^ '$Header$'
|
|
130 |
!
|
|
131 |
|
|
132 |
version_CVS
|
|
133 |
^ '$Header$'
|
|
134 |
! !
|
|
135 |
|