aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/test_utils/TestPExpectTest.py
blob: 9992a4442744b36817c1e57e2ac456bc658fcb5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Test the PExpectTest test functions.
"""

from lldbsuite.test.lldbpexpect import *


class TestPExpectTestCase(PExpectTest):
    NO_DEBUG_INFO_TESTCASE = True

    def assert_expect_fails_with(self, cmd, expect_args, expected_msg):
        try:
            self.expect(cmd, **expect_args)
        except AssertionError as e:
            self.assertIn(expected_msg, str(e))
        else:
            self.fail("expect should have raised AssertionError!")

    def test_expect(self):
        # Test that passing a string to the 'substrs' argument is rejected.
        self.assert_expect_fails_with(
            "settings list prompt",
            dict(substrs="some substring"),
            "substrs must be a collection of strings",
        )