2 from __future__ import absolute_import
6 from bup import shquote
10 return [word for offset,word in shquote.quotesplit(line)]
13 WVPASSEQ(qst(b""" this is basic \t\n\r text """),
14 [b'this', b'is', b'basic', b'text'])
15 WVPASSEQ(qst(br""" \"x\" "help" 'yelp' """), [b'"x"', b'help', b'yelp'])
16 WVPASSEQ(qst(br""" "'\"\"'" '\"\'' """), [b"'\"\"'", b'\\"\''])
18 WVPASSEQ(shquote.quotesplit(b' this is "unfinished'),
19 [(2, b'this'), (7, b'is'), (10, b'unfinished')])
21 WVPASSEQ(shquote.quotesplit(b'"silly"\'will'),
22 [(0, b'silly'), (7, b'will')])
24 WVPASSEQ(shquote.unfinished_word(b'this is a "billy" "goat'),
26 WVPASSEQ(shquote.unfinished_word(b"'x"),
28 WVPASSEQ(shquote.unfinished_word(b"abra cadabra "),
30 WVPASSEQ(shquote.unfinished_word(b"abra cadabra"),
33 qtype, word = shquote.unfinished_word(b"this is /usr/loc")
34 WVPASSEQ(shquote.what_to_add(qtype, word, b"/usr/local", True),
36 qtype, word = shquote.unfinished_word(b"this is '/usr/loc")
37 WVPASSEQ(shquote.what_to_add(qtype, word, b"/usr/local", True),
39 qtype, word = shquote.unfinished_word(b"this is \"/usr/loc")
40 WVPASSEQ(shquote.what_to_add(qtype, word, b"/usr/local", True),
42 qtype, word = shquote.unfinished_word(b"this is \"/usr/loc")
43 WVPASSEQ(shquote.what_to_add(qtype, word, b"/usr/local", False),
45 qtype, word = shquote.unfinished_word(b"this is \\ hammer\\ \"")
46 WVPASSEQ(word, b' hammer "')
47 WVPASSEQ(shquote.what_to_add(qtype, word, b" hammer \"time\"", True),
50 WVPASSEQ(shquote.quotify_list([b'a', b'', b'"word"', b"'third'", b"'",
52 b"a '' '\"word\"' \"'third'\" \"'\" 'x y'")