summaryrefslogtreecommitdiff
path: root/test/DocTests.py
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2015-01-19 12:36:00 +0100
committerAlexis Hildebrandt <afh@surryhill.net>2015-01-27 22:01:09 +0100
commit3d7eb241514e380fb6311ca666eaa31cb02acb48 (patch)
tree1065a746fccaee6b7e8df1058351bdcf7b152b2f /test/DocTests.py
parent3b74b20eddeefbdc7144ce7414b4a4c779876676 (diff)
downloadfork-ledger-3d7eb241514e380fb6311ca666eaa31cb02acb48.tar.gz
fork-ledger-3d7eb241514e380fb6311ca666eaa31cb02acb48.tar.bz2
fork-ledger-3d7eb241514e380fb6311ca666eaa31cb02acb48.zip
[doc] Improve @smallexample command line parsing
by using Python shlex.
Diffstat (limited to 'test/DocTests.py')
-rwxr-xr-xtest/DocTests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/DocTests.py b/test/DocTests.py
index d3434b43..cbad9ca7 100755
--- a/test/DocTests.py
+++ b/test/DocTests.py
@@ -4,6 +4,7 @@
import os
import re
import sys
+import shlex
import hashlib
import argparse
import subprocess
@@ -33,6 +34,7 @@ class DocTests:
line = self.file.readline()
self.current_line += 1
if len(line) <= 0 or endexample.match(line): break
+ # Replace special texinfo character sequences with their ASCII counterpart
example += line.replace("@@","@").replace("@{","{").replace("@}","}")
return example
@@ -111,11 +113,11 @@ class DocTests:
else:
return None
- command = command.rstrip().split()
+ command = shlex.split(command)
if command[0] == '$': command.remove('$')
index = command.index('ledger')
command[index] = self.ledger
- for i,argument in enumerate('--args-only --columns 80'.split()):
+ for i,argument in enumerate(shlex.split('--args-only --columns 80')):
command.insert(index+i+1, argument)
try: