13c454769SJim Ingham""" 23c454769SJim InghamThis tests some simple examples of parsing regex commands 33c454769SJim Ingham""" 43c454769SJim Ingham 53c454769SJim Inghamimport os 63c454769SJim Inghamimport lldb 73c454769SJim Inghamimport lldbsuite.test.lldbutil as lldbutil 83c454769SJim Inghamfrom lldbsuite.test.lldbtest import * 93c454769SJim Ingham 103c454769SJim Ingham 113c454769SJim Inghamclass TestCommandRegexParsing(TestBase): 123c454769SJim Ingham NO_DEBUG_INFO_TESTCASE = True 133c454769SJim Ingham 143c454769SJim Ingham def test_sample_rename_this(self): 153c454769SJim Ingham """Try out some simple regex commands, make sure they parse correctly.""" 16*2238dcc3SJonas Devlieghere self.runCmd( 17*2238dcc3SJonas Devlieghere "command regex one-substitution 's/(.+)/echo-cmd %1-first %1-second %1-third/'" 18*2238dcc3SJonas Devlieghere ) 19*2238dcc3SJonas Devlieghere self.expect( 20*2238dcc3SJonas Devlieghere "one-substitution ASTRING", 21*2238dcc3SJonas Devlieghere substrs=["ASTRING-first", "ASTRING-second", "ASTRING-third"], 22*2238dcc3SJonas Devlieghere ) 233c454769SJim Ingham 24*2238dcc3SJonas Devlieghere self.runCmd( 25*2238dcc3SJonas Devlieghere "command regex two-substitution 's/([^ ]+) ([^ ]+)/echo-cmd %1-first %2-second %1-third %2-fourth/'" 26*2238dcc3SJonas Devlieghere ) 27*2238dcc3SJonas Devlieghere self.expect( 28*2238dcc3SJonas Devlieghere "two-substitution ASTRING BSTRING", 29*2238dcc3SJonas Devlieghere substrs=[ 30*2238dcc3SJonas Devlieghere "ASTRING-first", 31*2238dcc3SJonas Devlieghere "BSTRING-second", 32*2238dcc3SJonas Devlieghere "ASTRING-third", 33*2238dcc3SJonas Devlieghere "BSTRING-fourth", 34*2238dcc3SJonas Devlieghere ], 35*2238dcc3SJonas Devlieghere ) 363c454769SJim Ingham 373c454769SJim Ingham def setUp(self): 383c454769SJim Ingham # Call super's setUp(). 393c454769SJim Ingham TestBase.setUp(self) 40*2238dcc3SJonas Devlieghere self.runCmd( 41*2238dcc3SJonas Devlieghere "command script import " 42*2238dcc3SJonas Devlieghere + os.path.join(self.getSourceDir(), "echo_command.py") 43*2238dcc3SJonas Devlieghere ) 443c454769SJim Ingham self.runCmd("command script add echo-cmd -f echo_command.echo_command") 45