1210
|
1 |
"{ Package: 'exept:regression' }"
|
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#StreamUpToTests
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'tests-regression'
|
|
10 |
!
|
|
11 |
|
|
12 |
!StreamUpToTests class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
|
19 |
ca
|
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
! !
|
|
29 |
|
|
30 |
!StreamUpToTests methodsFor:'initialize / release'!
|
|
31 |
|
|
32 |
setUp
|
|
33 |
"common setup - invoked before testing."
|
|
34 |
|
|
35 |
super setUp
|
|
36 |
!
|
|
37 |
|
|
38 |
tearDown
|
|
39 |
"common cleanup - invoked after testing."
|
|
40 |
|
|
41 |
super tearDown
|
|
42 |
! !
|
|
43 |
|
|
44 |
!StreamUpToTests methodsFor:'tests'!
|
|
45 |
|
|
46 |
test1_Array
|
|
47 |
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 .
|
|
49 |
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 .
|
|
51 |
|
|
52 |
self assert:( #( $a $b $c $d ) readStream upTo:$a ) = #().
|
|
53 |
self assert:( #( $a $b $c $d ) readStream upTo:$a; position ) = 1.
|
|
54 |
|
|
55 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c ) = #($b "16r62") .
|
|
56 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$c; position ) = 3 .
|
|
57 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1 ) = #($b "16r62" $c "16r63" $d "16r64") .
|
|
58 |
self assert:( #( $a $b $c $d ) readStream next; upTo:$1; position ) = 4 .
|
|
59 |
|
|
60 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c ) = #( $d $a $b) .
|
|
61 |
self assert:( #( $a $b $c $d $a $b $c $d ) readStream next:3; upTo:$c; position ) = 7.
|
|
62 |
|
|
63 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c ) = #($a "16r61" $b "16r62") .
|
|
64 |
self assert:( #( $a $b $c $d $e $f) readStream readLimit:5; upTo:$c; position ) = 3 .
|
|
65 |
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 .
|
|
67 |
!
|
|
68 |
|
|
69 |
test1_String
|
|
70 |
self assert:( 'abcd' readStream upTo:$c ) = 'ab'.
|
|
71 |
self assert:( 'abcd' readStream upTo:$c; position ) = 3.
|
|
72 |
self assert:( 'abcd' readStream upTo:$1 ) = 'abcd'.
|
|
73 |
self assert:( 'abcd' readStream upTo:$1; position ) = 4.
|
|
74 |
|
|
75 |
self assert:( 'abcd' readStream upTo:$a ) = ''.
|
|
76 |
self assert:( 'abcd' readStream upTo:$a; position ) = 1.
|
|
77 |
|
|
78 |
|
|
79 |
self assert:( 'abcd' readStream next; upTo:$c ) = 'b' .
|
|
80 |
self assert:( 'abcd' readStream next; upTo:$c; position ) = 3.
|
|
81 |
self assert:( 'abcd' readStream next; upTo:$1 ) = 'bcd' .
|
|
82 |
self assert:( 'abcd' readStream next; upTo:$1; position ) = 4.
|
|
83 |
|
|
84 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c ) = 'dab' .
|
|
85 |
self assert:( 'abcdabcd' readStream next:3; upTo:$c; position ) = 7.
|
|
86 |
|
|
87 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c ) = 'ab' .
|
|
88 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$c; position ) = 3.
|
|
89 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1 ) = 'abcde'.
|
|
90 |
self assert:( 'abcdef' readStream readLimit:5; upTo:$1; position ) = 5.
|
|
91 |
! !
|
|
92 |
|
|
93 |
!StreamUpToTests class methodsFor:'documentation'!
|
|
94 |
|
|
95 |
version
|
|
96 |
^ '$Header$'
|
|
97 |
!
|
|
98 |
|
|
99 |
version_CVS
|
|
100 |
^ '$Header$'
|
|
101 |
! !
|
|
102 |
|