RegressionTests__IndentStreamTest.st
author Claus Gittinger <cg@exept.de>
Sun, 01 Jul 2018 10:28:54 +0200
changeset 1979 69cd18d16f05
parent 1978 0ac513a7e77d
child 1980 be2895006916
permissions -rw-r--r--
#QUALITY by cg class: RegressionTests::IndentStreamTest added: #testGeneratedOutput category of: #testConstructors #testIndent #testIndentBack

"{ Encoding: utf8 }"

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

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


!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$'
! !