1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/units
Marius Gedminas 0a7f2c202b Improve --diff output when files lack trailing newlines
The behavior now matches GNU diff.

Fixes #14094.

Example of output before this change:

    TASK [healthchecks.io : hourly healthchecks.io ping] ***************************
    changed: [ranka]
    --- before: /etc/cron.hourly/mg-healthchecks-dot-io
    +++ after: /tmp/tmpOTvXTw
    @@ -1,2 +1,2 @@
     #!/bin/sh
    -curl -sS https://hchk.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /dev/null+curl -sS https://hchk.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /dev/null

after this change:

    TASK [healthchecks.io : hourly healthchecks.io ping] ***************************
    changed: [ranka]
    --- before: /etc/cron.hourly/mg-healthchecks-dot-io
    +++ after: /tmp/tmpOTvXTw
    @@ -1,2 +1,2 @@
     #!/bin/sh
    -curl -sS https://hchk.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /dev/null
    \ No newline at end of file
    +curl -sS https://hchk.io/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx > /dev/null

The added unit tests contain more examples.

This commit also takes care to avoid "no newline at EOF" warnings when
no_log is in effect, and also when modules return dicts rather than
strings.  (It also removes trailing whitespace from using json
serialization when diffing dicts, because I hate trailing whitespace in
Python source files, even if they're test files.)
2017-01-09 11:49:03 -05:00
..
cli testing GalaxyCLI.run() does what is expected 2016-12-21 23:52:18 -08:00
contrib skip vmware inventory when missing lib 2016-11-07 15:37:59 -05:00
errors Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00
executor Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00
inventory Add lots of test cases to inventory/test_host.py (#17827) 2016-11-29 13:38:04 -05:00
inventory_test_data/group_vars Merge branch 'v2_final' into devel_switch_v2 2015-05-28 15:26:03 -05:00
mock Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00
module_utils Adding auth support for google-api-python-client and gcloud-python (#19090) 2016-12-29 12:33:52 -05:00
modules refactors ios_config to use network_cli plugin (#20042) 2017-01-09 11:19:25 -05:00
parsing Add a encode() to AnsibleVaultEncryptedUnicode (#19840) 2017-01-04 12:17:19 -05:00
playbook unit tests for playbook/conditional.py (#18586) 2016-12-13 14:38:16 -05:00
plugins Improve --diff output when files lack trailing newlines 2017-01-09 11:49:03 -05:00
template Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00
utils FEATURE: adding variable serial batches 2016-08-04 15:04:10 -05:00
vars ansible_playbook_python (#18530) 2016-11-23 16:30:46 -05:00
__init__.py Add empty-init code-smell script. (#18406) 2016-11-07 15:02:13 -08:00