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