RegressionTests__StreamUpToTests.st
changeset 1211 d271e7a8d085
parent 1210 4a673778205d
child 1279 b6f6576c2106
equal deleted inserted replaced
1210:4a673778205d 1211:d271e7a8d085
    42 ! !
    42 ! !
    43 
    43 
    44 !StreamUpToTests methodsFor:'tests'!
    44 !StreamUpToTests methodsFor:'tests'!
    45 
    45 
    46 test1_Array
    46 test1_Array
       
    47 
       
    48     self assert:( #( ) readStream upTo:$c  ) = #().
       
    49     self assert:( #( ) readStream upTo:$c; position  ) = 0          .
       
    50 
       
    51     self assert:( #( $a $b ) readStream next; next; upTo:$c  ) = #().
       
    52     self assert:( #( $a $b ) readStream next; next; upTo:$c; position  ) = 2          .
       
    53 
    47     self assert:( #( $a $b $c $d ) readStream upTo:$c  ) = #($a "16r61" $b "16r62").
    54     self assert:( #( $a $b $c $d ) readStream upTo:$c  ) = #($a "16r61" $b "16r62").
    48     self assert:( #( $a $b $c $d ) readStream upTo:$c; position  ) = 3          .
    55     self assert:( #( $a $b $c $d ) readStream upTo:$c; position  ) = 3          .
    49     self assert:( #( $a $b $c $d ) readStream upTo:$1  ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64")    .
    56     self assert:( #( $a $b $c $d ) readStream upTo:$1  ) = #($a "16r61" $b "16r62" $c "16r63" $d "16r64")    .
    50     self assert:( #( $a $b $c $d ) readStream upTo:$1; position  ) = 4          .
    57     self assert:( #( $a $b $c $d ) readStream upTo:$1; position  ) = 4          .
    51 
    58 
    65     self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1  ) = #($a "16r61" $b "16r62" $c  "16r63" $d "16r64" $e "16r65").
    72     self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1  ) = #($a "16r61" $b "16r62" $c  "16r63" $d "16r64" $e "16r65").
    66     self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1; position  ) = 5   .
    73     self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$1; position  ) = 5   .
    67 !
    74 !
    68 
    75 
    69 test1_String
    76 test1_String
       
    77 
       
    78     self assert:( 'ab' readStream next; next; upTo:$c  ) = ''.
       
    79     self assert:( 'ab' readStream next; next; upTo:$c; position  ) = 2          .
       
    80 
    70     self assert:( 'abcd' readStream upTo:$c  ) = 'ab'.
    81     self assert:( 'abcd' readStream upTo:$c  ) = 'ab'.
    71     self assert:( 'abcd' readStream upTo:$c; position  ) = 3.
    82     self assert:( 'abcd' readStream upTo:$c; position  ) = 3.
    72     self assert:( 'abcd' readStream upTo:$1  ) = 'abcd'.   
    83     self assert:( 'abcd' readStream upTo:$1  ) = 'abcd'.   
    73     self assert:( 'abcd' readStream upTo:$1; position  ) = 4.
    84     self assert:( 'abcd' readStream upTo:$1; position  ) = 4.
    74 
    85