diff options
author | Davide Italiano <davide@freebsd.org> | 2019-03-12 20:41:24 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2019-03-12 20:41:24 +0000 |
commit | 205fd03a27dcf1649f4facaf8d80d219e2937d9d (patch) | |
tree | 59e5ddf3f860f20b05a9b4b043b26c0eabb5840b /lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py | |
parent | e2b8c40a7726806557fb17666478e60ada1c7439 (diff) | |
download | bcm5719-llvm-205fd03a27dcf1649f4facaf8d80d219e2937d9d.tar.gz bcm5719-llvm-205fd03a27dcf1649f4facaf8d80d219e2937d9d.zip |
[third-party] Update pexpect to 4.6.
Reviewers: labath, jdevlieghere
Subscribers: lldb-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59159
llvm-svn: 355967
Diffstat (limited to 'lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py')
-rw-r--r-- | lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py new file mode 100644 index 00000000000..3425fd2110e --- /dev/null +++ b/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py @@ -0,0 +1,34 @@ +import io +import sys +import unittest +try: + import builtins +except ImportError: + import __builtin__ as builtins + +PY3 = (sys.version_info[0] >= 3) +input_name = 'input' if PY3 else 'raw_input' + +from pexpect import FSM + +class FSMTestCase(unittest.TestCase): + def test_run_fsm(self): + def _input(prompt): + return "167 3 2 2 * * * 1 - =" + orig_input = getattr(builtins, input_name) + orig_stdout = sys.stdout + setattr(builtins, input_name, _input) + sys.stdout = sio = (io.StringIO if PY3 else io.BytesIO)() + + try: + FSM.main() + finally: + setattr(builtins, input_name, orig_input) + sys.stdout = orig_stdout + + printed = sio.getvalue() + assert '2003' in printed, printed + + +if __name__ == '__main__': + unittest.main()
\ No newline at end of file |