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