4 from bup import shquote
5 from buptest import no_lingering_errors
9 return [word for offset,word in shquote.quotesplit(line)]
13 with no_lingering_errors():
14 WVPASSEQ(qst(""" this is basic \t\n\r text """),
15 ['this', 'is', 'basic', 'text'])
16 WVPASSEQ(qst(r""" \"x\" "help" 'yelp' """), ['"x"', 'help', 'yelp'])
17 WVPASSEQ(qst(r""" "'\"\"'" '\"\'' """), ["'\"\"'", '\\"\''])
19 WVPASSEQ(shquote.quotesplit(' this is "unfinished'),
20 [(2,'this'), (7,'is'), (10,'unfinished')])
22 WVPASSEQ(shquote.quotesplit('"silly"\'will'),
23 [(0,'silly'), (7,'will')])
25 WVPASSEQ(shquote.unfinished_word('this is a "billy" "goat'),
27 WVPASSEQ(shquote.unfinished_word("'x"),
29 WVPASSEQ(shquote.unfinished_word("abra cadabra "),
31 WVPASSEQ(shquote.unfinished_word("abra cadabra"),
34 (qtype, word) = shquote.unfinished_word("this is /usr/loc")
35 WVPASSEQ(shquote.what_to_add(qtype, word, "/usr/local", True),
37 (qtype, word) = shquote.unfinished_word("this is '/usr/loc")
38 WVPASSEQ(shquote.what_to_add(qtype, word, "/usr/local", True),
40 (qtype, word) = shquote.unfinished_word("this is \"/usr/loc")
41 WVPASSEQ(shquote.what_to_add(qtype, word, "/usr/local", True),
43 (qtype, word) = shquote.unfinished_word("this is \"/usr/loc")
44 WVPASSEQ(shquote.what_to_add(qtype, word, "/usr/local", False),
46 (qtype, word) = shquote.unfinished_word("this is \\ hammer\\ \"")
47 WVPASSEQ(word, ' hammer "')
48 WVPASSEQ(shquote.what_to_add(qtype, word, " hammer \"time\"", True),
51 WVPASSEQ(shquote.quotify_list(['a', '', '"word"', "'third'", "'", "x y"]),
52 "a '' '\"word\"' \"'third'\" \"'\" 'x y'")