(self, p)
| 340 | assert index == 0, "index="+str(index) |
| 341 | |
| 342 | def _expect_echo_toggle(self, p): |
| 343 | p.sendline (b'1234') # Should see this twice (once from tty echo and again from cat). |
| 344 | index = p.expect ([ |
| 345 | b'1234', |
| 346 | b'abcd', |
| 347 | b'wxyz', |
| 348 | pexpect.EOF, |
| 349 | pexpect.TIMEOUT]) |
| 350 | assert index == 0, "index="+str(index)+"\n"+p.before |
| 351 | index = p.expect ([ |
| 352 | b'1234', |
| 353 | b'abcd', |
| 354 | b'wxyz', |
| 355 | pexpect.EOF]) |
| 356 | assert index == 0, "index="+str(index) |
| 357 | p.setecho(0) # Turn off tty echo |
| 358 | p.waitnoecho() |
| 359 | p.sendline (b'abcd') # Now, should only see this once. |
| 360 | p.sendline (b'wxyz') # Should also be only once. |
| 361 | index = p.expect ([ |
| 362 | pexpect.EOF, |
| 363 | pexpect.TIMEOUT, |
| 364 | b'abcd', |
| 365 | b'wxyz', |
| 366 | b'1234']) |
| 367 | assert index == 2, "index="+str(index) |
| 368 | index = p.expect ([ |
| 369 | pexpect.EOF, |
| 370 | b'abcd', |
| 371 | b'wxyz', |
| 372 | b'7890']) |
| 373 | assert index == 2, "index="+str(index) |
| 374 | p.setecho(1) # Turn on tty echo |
| 375 | p.sendline (b'7890') # Should see this twice. |
| 376 | index = p.expect ([pexpect.EOF,b'abcd',b'wxyz',b'7890']) |
| 377 | assert index == 3, "index="+str(index) |
| 378 | index = p.expect ([pexpect.EOF,b'abcd',b'wxyz',b'7890']) |
| 379 | assert index == 3, "index="+str(index) |
| 380 | p.sendeof() |
| 381 | |
| 382 | def test_expect_index (self): |
| 383 | '''This tests that mixed list of regex strings, TIMEOUT, and EOF all |
no test coverage detected