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