summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-06 13:40:02 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-06 13:40:02 +0100
commit6c2e100abad1ae5e8dcb112e61040f0941da7d62 (patch)
treef878e01781f9fb526345492a9a973466bbda1c0b /yarns
parent599e095cda626ff66c789017a752d7f91678d033 (diff)
downloadick2-6c2e100abad1ae5e8dcb112e61040f0941da7d62.tar.gz
Add: unescape function
This will allow us to use \n in (selected) scenario step strings.
Diffstat (limited to 'yarns')
-rw-r--r--yarns/lib.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/yarns/lib.py b/yarns/lib.py
index d5559b1..486757c 100644
--- a/yarns/lib.py
+++ b/yarns/lib.py
@@ -62,6 +62,17 @@ def wait_for_port(port):
else:
return
+def unescape(s):
+ t = ''
+ while s:
+ if s.startswith('\\n'):
+ t += '\n'
+ s = s[2:]
+ else:
+ t += s[0]
+ s = s[1:]
+ return t
+
def write(filename, data):
with open(filename, 'w') as f:
f.write(data)