1""" 2This tests some simple examples of parsing regex commands 3""" 4 5import os 6import lldb 7import lldbsuite.test.lldbutil as lldbutil 8from lldbsuite.test.lldbtest import * 9 10 11class TestCommandRegexParsing(TestBase): 12 13 mydir = TestBase.compute_mydir(__file__) 14 15 NO_DEBUG_INFO_TESTCASE = True 16 17 def test_sample_rename_this(self): 18 """Try out some simple regex commands, make sure they parse correctly.""" 19 self.runCmd("command regex one-substitution 's/(.+)/echo-cmd %1-first %1-second %1-third/'") 20 self.expect("one-substitution ASTRING", 21 substrs = ["ASTRING-first", "ASTRING-second", "ASTRING-third"]) 22 23 self.runCmd("command regex two-substitution 's/([^ ]+) ([^ ]+)/echo-cmd %1-first %2-second %1-third %2-fourth/'") 24 self.expect("two-substitution ASTRING BSTRING", 25 substrs = ["ASTRING-first", "BSTRING-second", "ASTRING-third", "BSTRING-fourth"]) 26 27 def setUp(self): 28 # Call super's setUp(). 29 TestBase.setUp(self) 30 self.runCmd("command script import " + os.path.join(self.getSourceDir(), "echo_command.py")) 31 self.runCmd("command script add echo-cmd -f echo_command.echo_command") 32