1""" 2Test the PExpectTest test functions. 3""" 4 5 6import lldb 7import lldbsuite.test.lldbutil as lldbutil 8from lldbsuite.test.lldbtest import * 9from textwrap import dedent 10 11 12class TestPExpectTestCase(TestBase): 13 14 mydir = TestBase.compute_mydir(__file__) 15 NO_DEBUG_INFO_TESTCASE = True 16 17 def assert_expect_fails_with(self, cmd, expect_args, expected_msg): 18 try: 19 self.expect(cmd, **expect_args) 20 except AssertionError as e: 21 self.assertIn(expected_msg, str(e)) 22 else: 23 self.fail("expect should have raised AssertionError!") 24 25 def test_expect(self): 26 # Test that passing a string to the 'substrs' argument is rejected. 27 self.assert_expect_fails_with("settings list prompt", 28 dict(substrs="some substring"), 29 "substrs must be a collection of strings") 30