RegressionTests__IndentStreamTest.st
changeset 1979 69cd18d16f05
parent 1978 0ac513a7e77d
child 1980 be2895006916
equal deleted inserted replaced
1978:0ac513a7e77d 1979:69cd18d16f05
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "{ Package: 'stx:goodies/regression' }"
     3 "{ Package: 'stx:goodies/regression' }"
     2 
     4 
     3 "{ NameSpace: RegressionTests }"
     5 "{ NameSpace: RegressionTests }"
     4 
     6 
     5 TestCase subclass:#IndentStreamTest
     7 TestCase subclass:#IndentStreamTest
     8 	poolDictionaries:''
    10 	poolDictionaries:''
     9 	category:'Kiwi-Tests'
    11 	category:'Kiwi-Tests'
    10 !
    12 !
    11 
    13 
    12 
    14 
    13 !IndentStreamTest methodsFor:'as yet unclassified'!
    15 !IndentStreamTest methodsFor:'tests'!
    14 
    16 
    15 testConstructors
    17 testConstructors
    16 
    18 
    17     self assert:(IndentStream with: 'xxx') indentLevel = 0.
    19     self assert:(IndentStream with: 'xxx') indentLevel = 0.
    18     self assert:(IndentStream on: 'xxx') indentLevel = 0.
    20     self assert:(IndentStream on: 'xxx') indentLevel = 0.
    19 
    21 
    20     "Modified: / 01-07-2018 / 10:12:07 / Claus Gittinger"
    22     "Modified: / 01-07-2018 / 10:12:07 / Claus Gittinger"
       
    23 !
       
    24 
       
    25 testGeneratedOutput
       
    26         | stream |
       
    27         stream := IndentStream on: ''.
       
    28         stream nextPutLine:'line1'.
       
    29         stream indent.
       
    30         stream nextPutLine:'line2a'.
       
    31         stream nextPutLine:'line2b'.
       
    32         stream indent.
       
    33         stream nextPutLine:'line3a'.
       
    34         stream nextPutAll:'line3b'.
       
    35         stream indentBack; cr.
       
    36         stream nextPutLine:'line4a'.
       
    37         stream nextPutAll:'line4b'.
       
    38         stream indentBack; cr.
       
    39         stream nextPutLine:'line5'.
       
    40         self assert:stream contents =
       
    41 'line1
       
    42 \tline2a
       
    43 \tline2b
       
    44 \t\tline3a
       
    45 \t\tline3b
       
    46 \tline4a
       
    47 \tline4b
       
    48 line5
       
    49 ' withoutCEscapes
       
    50 
       
    51     "Created: / 01-07-2018 / 10:23:56 / Claus Gittinger"
    21 !
    52 !
    22 
    53 
    23 testIndent
    54 testIndent
    24 
    55 
    25         | stream |
    56         | stream |