From 764c5600d8fa795cd16f5b3ccfb78aa360b23a30 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 17 Dec 2018 01:33:42 +0100 Subject: [PATCH] shell & multiline YAML free form: add test ensure whitespace isn't added after a newline (see #45853) --- .../roles/test_good_parsing/tasks/main.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/integration/targets/parsing/roles/test_good_parsing/tasks/main.yml b/test/integration/targets/parsing/roles/test_good_parsing/tasks/main.yml index 0fb1337e86a..22ffe146da9 100644 --- a/test/integration/targets/parsing/roles/test_good_parsing/tasks/main.yml +++ b/test/integration/targets/parsing/roles/test_good_parsing/tasks/main.yml @@ -108,7 +108,23 @@ - assert: that: - result.stdout_lines == [ 'old', 'mcdonald', 'had', 'a', 'farm' ] + - result.cmd == 'echo old\necho mcdonald\necho had\necho a\necho farm\n' + - result.stdout_lines == [ 'old', 'mcdonald', 'had', 'a', 'farm' ] + +- name: 'multi-line inline shell commands (without variable, see: #45853)' + # literal block styles with strip block chomping indicator and 3 spaces indentation + shell: |-3 + cat - <<'EOF' + line1 + line2 + line3 + EOF + register: result + +- assert: + that: + - result.cmd == "cat - <<'EOF'\nline1\n line2\nline3\nEOF" + - result.stdout_lines == [ 'line1', ' line2', 'line3' ] - name: passing same arg to shell command is legit shell: echo foo --arg=a --arg=b