@@ -159,15 +159,6 @@ public void ReadLine_NoData_ReturnsNullAfterClose()
159
159
}
160
160
161
161
[ TestMethod ]
162
- [ Ignore ] // Fails because it returns the whole buffer i.e. "Hello World!\r\n12345"
163
- // We might actually want to keep that behaviour, but just make the documentation clearer.
164
- // The Expect documentation says:
165
- // "The text available in the shell that contains all the text that ends with expected expression."
166
- // Does that mean
167
- // 1. the returned string ends with the expected expression; or
168
- // 2. the returned string is all the text in the buffer, which is guaranteed to contain the expected expression?
169
- // The current behaviour is closer to 2. I think the documentation implies 1.
170
- // Either way, there are bugs.
171
162
public void Expect ( )
172
163
{
173
164
_channelSessionStub . Receive ( Encoding . UTF8 . GetBytes ( "Hello " ) ) ;
@@ -181,10 +172,6 @@ public void Expect()
181
172
// Case 1 above.
182
173
Assert . AreEqual ( "Hello World!\r \n 123" , _shellStream . Expect ( "123" ) ) ; // Fails, returns "Hello World!\r\n12345"
183
174
Assert . AreEqual ( "45" , _shellStream . Read ( ) ) ; // Passes, but should probably fail and return ""
184
-
185
- // Case 2 above.
186
- Assert . AreEqual ( "Hello World!\r \n 12345" , _shellStream . Expect ( "123" ) ) ; // Passes
187
- Assert . AreEqual ( "" , _shellStream . Read ( ) ) ; // Fails, returns "45"
188
175
}
189
176
190
177
[ TestMethod ]
@@ -213,7 +200,6 @@ public void ReadLine_MultiByte()
213
200
}
214
201
215
202
[ TestMethod ]
216
- [ Ignore ]
217
203
public void Expect_Regex_MultiByte ( )
218
204
{
219
205
_channelSessionStub . Receive ( Encoding . UTF8 . GetBytes ( "𐓏𐓘𐓻𐓘𐓻𐓟 𐒻𐓟" ) ) ;
@@ -223,7 +209,6 @@ public void Expect_Regex_MultiByte()
223
209
}
224
210
225
211
[ TestMethod ]
226
- [ Ignore ]
227
212
public void Expect_String_MultiByte ( )
228
213
{
229
214
_channelSessionStub . Receive ( Encoding . UTF8 . GetBytes ( "hello 你好" ) ) ;
@@ -232,6 +217,16 @@ public void Expect_String_MultiByte()
232
217
Assert . AreEqual ( "" , _shellStream . Read ( ) ) ;
233
218
}
234
219
220
+ [ TestMethod ]
221
+ public void Expect_String_non_ASCII_characters ( )
222
+ {
223
+ _channelSessionStub . Receive ( Encoding . UTF8 . GetBytes ( "Hello, こんにちは, Bonjour" ) ) ;
224
+
225
+ Assert . AreEqual ( "Hello, こ" , _shellStream . Expect ( new Regex ( @"[^\u0000-\u007F]" ) ) ) ;
226
+
227
+ Assert . AreEqual ( "んにちは, Bonjour" , _shellStream . Read ( ) ) ;
228
+ }
229
+
235
230
[ TestMethod ]
236
231
public void Expect_Timeout ( )
237
232
{
0 commit comments