2 from __future__ import absolute_import
6 from bup import shquote
7 from buptest import no_lingering_errors
11 return [word for offset,word in shquote.quotesplit(line)]
15 with no_lingering_errors():
16 WVPASSEQ(qst(b""" this is basic \t\n\r text """),
17 [b'this', b'is', b'basic', b'text'])
18 WVPASSEQ(qst(br""" \"x\" "help" 'yelp' """), [b'"x"', b'help', b'yelp'])
19 WVPASSEQ(qst(br""" "'\"\"'" '\"\'' """), [b"'\"\"'", b'\\"\''])
21 WVPASSEQ(shquote.quotesplit(b' this is "unfinished'),
22 [(2, b'this'), (7, b'is'), (10, b'unfinished')])
24 WVPASSEQ(shquote.quotesplit(b'"silly"\'will'),
25 [(0, b'silly'), (7, b'will')])
27 WVPASSEQ(shquote.unfinished_word(b'this is a "billy" "goat'),
29 WVPASSEQ(shquote.unfinished_word(b"'x"),
31 WVPASSEQ(shquote.unfinished_word(b"abra cadabra "),
33 WVPASSEQ(shquote.unfinished_word(b"abra cadabra"),
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", True),
45 qtype, word = shquote.unfinished_word(b"this is \"/usr/loc")
46 WVPASSEQ(shquote.what_to_add(qtype, word, b"/usr/local", False),
48 qtype, word = shquote.unfinished_word(b"this is \\ hammer\\ \"")
49 WVPASSEQ(word, b' hammer "')
50 WVPASSEQ(shquote.what_to_add(qtype, word, b" hammer \"time\"", True),
53 WVPASSEQ(shquote.quotify_list([b'a', b'', b'"word"', b"'third'", b"'",
55 b"a '' '\"word\"' \"'third'\" \"'\" 'x y'")