diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2017-12-15 14:40:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 14:40:02 -0500 |
commit | 2b7799f817e885a0c248216899c780ef6361c2e3 (patch) | |
tree | 687c5e834acb77728ee2a8ffba905c659322f502 /test/integration/targets/filters | |
parent | c2ac9d08318d838e4571587e153338f66eb22b0d (diff) | |
download | ansible-2b7799f817e885a0c248216899c780ef6361c2e3.tar.gz |
added flatten filter (#33102)
* added flatten filter
Diffstat (limited to 'test/integration/targets/filters')
-rw-r--r-- | test/integration/targets/filters/tasks/main.yml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/integration/targets/filters/tasks/main.yml b/test/integration/targets/filters/tasks/main.yml index 4daabde476..28821bd258 100644 --- a/test/integration/targets/filters/tasks/main.yml +++ b/test/integration/targets/filters/tasks/main.yml @@ -168,3 +168,20 @@ that: - _bad_urlsplit_filter is failed - "'unknown URL component' in _bad_urlsplit_filter.msg" + +- name: Flatten tests + block: + - name: use flatten + set_fact: + flat_full: '{{orig_list|flatten}}' + flat_one: '{{orig_list|flatten(levels=1)}}' + flat_two: '{{orig_list|flatten(levels=2)}}' + + - name: Verify flatten filter works as expected + assert: + that: + - flat_full == [1, 2, 3, 4, 5, 6, 7] + - flat_one == [1, 2, 3, [4, [5]], 6, 7] + - flat_two == [1, 2, 3, 4, [5], 6, 7] + vars: + orig_list: [1, 2, [3, [4, [5]], 6], 7] |