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

"{ Encoding: utf8 }"

"
MIT License

Copyright (c) 2016 Nahuel Garbezza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#IndentStreamTest
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kiwi-Tests'
!

!IndentStreamTest class methodsFor:'documentation'!

copyright
"
MIT License

Copyright (c) 2016 Nahuel Garbezza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

"
! !

!IndentStreamTest methodsFor:'tests'!

testConstructors

    self assert:(IndentStream with: 'xxx') indentLevel = 0.
    self assert:(IndentStream on: 'xxx') indentLevel = 0.

    "Modified: / 01-07-2018 / 10:12:07 / Claus Gittinger"
!

testGeneratedOutput
        | stream |
        stream := IndentStream on: ''.
        stream nextPutLine:'line1'.
        stream indent.
        stream nextPutLine:'line2a'.
        stream nextPutLine:'line2b'.
        stream indent.
        stream nextPutLine:'line3a'.
        stream nextPutAll:'line3b'.
        stream indentBack; cr.
        stream nextPutLine:'line4a'.
        stream nextPutAll:'line4b'.
        stream indentBack; cr.
        stream nextPutLine:'line5'.
        self assert:stream contents =
'line1
\tline2a
\tline2b
\t\tline3a
\t\tline3b
\tline4a
\tline4b
line5
' withoutCEscapes

    "Created: / 01-07-2018 / 10:23:56 / Claus Gittinger"
!

testIndent

        | stream |
        stream := IndentStream on: 'xxx'.
        stream indent; indent.
        self assert:(stream indentLevel = 2).

    "Modified: / 01-07-2018 / 10:12:22 / Claus Gittinger"
!

testIndentBack

        | stream |
        stream := IndentStream on: 'xxx'.
        stream indent; indent.
        stream indentBack.
        self assert:stream indentLevel = 1.

    "Modified: / 01-07-2018 / 10:12:35 / Claus Gittinger"
! !

!IndentStreamTest class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !