This test supposed to check the test base we are using for pexpect tests, but instead it used the normal TestBase class we use for all other tests. TestBase already had the substrs type check since D88792 so this test was passing because of that. This just changes the test base of the test to the pexpect one so that the `expect` calls find their intended target function. Also moves the check to the very start so that we can check the argument without actually having to start a terminal and all that jazz. (I found this by accident as D88792 got somehow reverted in a downstream branch so this test started failing). Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D96556
25 lines
768 B
Python
25 lines
768 B
Python
"""
|
|
Test the PExpectTest test functions.
|
|
"""
|
|
|
|
from lldbsuite.test.lldbpexpect import *
|
|
|
|
class TestPExpectTestCase(PExpectTest):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
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")
|