mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
parent
039e4571b9
commit
63bf2f6d9a
4 changed files with 35 additions and 12 deletions
|
@ -170,14 +170,17 @@
|
|||
- "shell_result4.changed == False"
|
||||
|
||||
- name: execute a shell command using a literal multiline block
|
||||
args:
|
||||
executable: /bin/bash
|
||||
shell: |
|
||||
echo this is a
|
||||
"multiline echo"
|
||||
"with a new line
|
||||
in quotes"
|
||||
| md5sum
|
||||
| tr -s ' '
|
||||
in quotes" \
|
||||
| md5sum \
|
||||
| tr -s ' ' \
|
||||
| cut -f1 -d ' '
|
||||
echo "this is a second line"
|
||||
register: shell_result5
|
||||
|
||||
- debug: var=shell_result5
|
||||
|
@ -186,5 +189,5 @@
|
|||
assert:
|
||||
that:
|
||||
- "shell_result5.changed"
|
||||
- "shell_result5.stdout == '32f3cc201b69ed8afa3902b80f554ca8'"
|
||||
- "shell_result5.stdout == '32f3cc201b69ed8afa3902b80f554ca8\nthis is a second line'"
|
||||
|
||||
|
|
|
@ -705,9 +705,9 @@ class TestUtils(unittest.TestCase):
|
|||
# jinja2 loop blocks with lots of complexity
|
||||
_test_combo(
|
||||
# in memory of neighbors cat
|
||||
# we only preserve newlines inside of quotes
|
||||
'a {% if x %} y {%else %} {{meow}} {% endif %} "cookie\nchip"\ndone',
|
||||
['a', '{% if x %}', 'y', '{%else %}', '{{meow}}', '{% endif %}', '"cookie\nchip"', 'done']
|
||||
# we preserve line breaks unless a line continuation character preceeds them
|
||||
'a {% if x %} y {%else %} {{meow}} {% endif %} "cookie\nchip" \\\ndone\nand done',
|
||||
['a', '{% if x %}', 'y', '{%else %}', '{{meow}}', '{% endif %}', '"cookie\nchip"', 'done', '\nand', 'done']
|
||||
)
|
||||
|
||||
# test space preservation within quotes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue