12f84b59aSRaphael Isemann""" 22f84b59aSRaphael IsemannTest the PExpectTest test functions. 32f84b59aSRaphael Isemann""" 42f84b59aSRaphael Isemann 5*0c118831SRaphael Isemannfrom lldbsuite.test.lldbpexpect import * 62f84b59aSRaphael Isemann 7*0c118831SRaphael Isemannclass TestPExpectTestCase(PExpectTest): 82f84b59aSRaphael Isemann NO_DEBUG_INFO_TESTCASE = True 92f84b59aSRaphael Isemann 102f84b59aSRaphael Isemann def assert_expect_fails_with(self, cmd, expect_args, expected_msg): 112f84b59aSRaphael Isemann try: 122f84b59aSRaphael Isemann self.expect(cmd, **expect_args) 132f84b59aSRaphael Isemann except AssertionError as e: 142f84b59aSRaphael Isemann self.assertIn(expected_msg, str(e)) 152f84b59aSRaphael Isemann else: 162f84b59aSRaphael Isemann self.fail("expect should have raised AssertionError!") 172f84b59aSRaphael Isemann 182f84b59aSRaphael Isemann def test_expect(self): 192f84b59aSRaphael Isemann # Test that passing a string to the 'substrs' argument is rejected. 202f84b59aSRaphael Isemann self.assert_expect_fails_with("settings list prompt", 212f84b59aSRaphael Isemann dict(substrs="some substring"), 222f84b59aSRaphael Isemann "substrs must be a collection of strings") 23