Skip to content
Snippets Groups Projects
  • Ryan Gonzalez's avatar
    986cd6d1
    tests: Add helpers for showing string diffs · 986cd6d1
    Ryan Gonzalez authored
    
    `_srt_show_diff` will run an external diff tool on both of the given
    strings, and `_srt_assert_streq_diff` is a lightweight macro to perform
    assert equality but use `_srt_show_diff` on error.
    
    This is largely based on the diff-ing code from
    `tests/system-info-cli.c` (ad877aae),
    with some changes:
    
    - _srt_async_signal_safe_error is an internal function, so it uses
      `GSubprocessLauncher` to be able to redirect stdout to stderr instead.
    - Supports reading the diff tool and options from `$SRT_DIFF` and
      `$SRT_DIFF_OPTS`, respectively, to make room for using alternate diff
      tools on hairier test failures.
    
    Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
    986cd6d1
    History
    tests: Add helpers for showing string diffs
    Ryan Gonzalez authored
    
    `_srt_show_diff` will run an external diff tool on both of the given
    strings, and `_srt_assert_streq_diff` is a lightweight macro to perform
    assert equality but use `_srt_show_diff` on error.
    
    This is largely based on the diff-ing code from
    `tests/system-info-cli.c` (ad877aae),
    with some changes:
    
    - _srt_async_signal_safe_error is an internal function, so it uses
      `GSubprocessLauncher` to be able to redirect stdout to stderr instead.
    - Supports reading the diff tool and options from `$SRT_DIFF` and
      `$SRT_DIFF_OPTS`, respectively, to make room for using alternate diff
      tools on hairier test failures.
    
    Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>