|
3 | 3 | from conftest import TestUnitBase, assert_bash_exec |
4 | 4 |
|
5 | 5 |
|
6 | | -@pytest.mark.bashcomp(cmd=None) |
| 6 | +@pytest.mark.bashcomp( |
| 7 | + cmd=None, |
| 8 | + ignore_env=r"^\+declare -f __tester$", |
| 9 | +) |
7 | 10 | class TestUnitQuote(TestUnitBase): |
8 | 11 | def test_1(self, bash): |
| 12 | + assert_bash_exec( |
| 13 | + bash, |
| 14 | + '__tester() { local ret; _comp_quote "$1"; printf %s "$ret"; }', |
| 15 | + ) |
9 | 16 | output = assert_bash_exec( |
10 | | - bash, 'quote "a b"', want_output=True, want_newline=False |
| 17 | + bash, '__tester "a b"', want_output=True, want_newline=False |
11 | 18 | ) |
12 | 19 | assert output.strip() == "'a b'" |
13 | 20 |
|
14 | 21 | def test_2(self, bash): |
15 | 22 | output = assert_bash_exec( |
16 | | - bash, 'quote "a b"', want_output=True, want_newline=False |
| 23 | + bash, '__tester "a b"', want_output=True, want_newline=False |
17 | 24 | ) |
18 | 25 | assert output.strip() == "'a b'" |
19 | 26 |
|
20 | 27 | def test_3(self, bash): |
21 | 28 | output = assert_bash_exec( |
22 | | - bash, 'quote " a "', want_output=True, want_newline=False |
| 29 | + bash, '__tester " a "', want_output=True, want_newline=False |
23 | 30 | ) |
24 | 31 | assert output.strip() == "' a '" |
25 | 32 |
|
26 | 33 | def test_4(self, bash): |
27 | 34 | output = assert_bash_exec( |
28 | | - bash, "quote \"a'b'c\"", want_output=True, want_newline=False |
| 35 | + bash, "__tester \"a'b'c\"", want_output=True, want_newline=False |
29 | 36 | ) |
30 | 37 | assert output.strip() == r"'a'\''b'\''c'" |
31 | 38 |
|
32 | 39 | def test_5(self, bash): |
33 | 40 | output = assert_bash_exec( |
34 | | - bash, 'quote "a\'"', want_output=True, want_newline=False |
| 41 | + bash, '__tester "a\'"', want_output=True, want_newline=False |
35 | 42 | ) |
36 | 43 | assert output.strip() == r"'a'\'''" |
0 commit comments