summaryrefslogtreecommitdiffstats
path: root/testing/runtests.py
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-07-16 17:16:19 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-07-16 17:16:19 (GMT)
commit08686b4117ae8b0f8dc3711e169e3da3fa1fe8fc (patch)
tree3f4c08b379cbbdd4d050cab18ebb842f1cf1999c /testing/runtests.py
parent1e358a1562ac50fa44b31764c08ac35996271dbd (diff)
downloadDoxygen-08686b4117ae8b0f8dc3711e169e3da3fa1fe8fc.zip
Doxygen-08686b4117ae8b0f8dc3711e169e3da3fa1fe8fc.tar.gz
Doxygen-08686b4117ae8b0f8dc3711e169e3da3fa1fe8fc.tar.bz2
Restructured the split_and_keep function
Diffstat (limited to 'testing/runtests.py')
-rwxr-xr-xtesting/runtests.py27
1 files changed, 7 insertions, 20 deletions
diff --git a/testing/runtests.py b/testing/runtests.py
index 129a781..6b3e54e 100755
--- a/testing/runtests.py
+++ b/testing/runtests.py
@@ -474,26 +474,13 @@ class TestManager:
shutil.rmtree("dtd",ignore_errors=True)
shutil.copytree(self.args.inputdir+"/dtd", "dtd")
-def split_and_keep(s, sep):
- if not s: return []
-
- # Find replacement character that is not used in string
- # i.e. just use the highest available character plus one
- # Note: This fails if ord(max(s)) = 0x10FFFF (ValueError)
- p=chr(ord(max(s))+1)
-
- retVal = []
- for val in s.replace(sep, p+sep).split(p):
- vv = val.split(" ",1)
- if ((len(vv) == 1) and not vv[0] == ''):
- retVal += vv
- if (len(vv) == 2):
- vv[1] = vv[1].strip()
- if ((len(vv) == 2) and not vv[1] == ''):
- retVal += vv
- if ((len(vv) == 2) and vv[1] == ''):
- retVal += [vv[0]]
- return retVal
+def split_and_keep(s,sep):
+ s = s.replace(sep,'\0'+sep) # add token separator
+ s = s.split('\0') # split by null delimiter
+ s = [x.strip() for x in filter(None,s)] # strip and remove empty elements
+ s = [z.split(' ',1) for z in s] # split by first space
+ s = [i for ss in s for i in ss] # flatten the list
+ return s
def main():
# argument handling