From b6342633cd0a0a03a85cd727dc1ff5d3cbc9dcb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Thu, 13 May 2021 14:12:11 +0200 Subject: [PATCH] Use `which` instead of `tar` as reference tldr page in tests (#192) The page for `tar` changes pretty frequently. `which` was last updated in 2018 and is a rather simple command overall. So it is less likely that the reference in the repository has to be updated as often as the one for `tar`. --- tests/lib.rs | 12 ++++++------ tests/tar-markdown.expected | 37 ----------------------------------- tests/which-markdown.expected | 11 +++++++++++ 3 files changed, 17 insertions(+), 43 deletions(-) delete mode 100644 tests/tar-markdown.expected create mode 100644 tests/which-markdown.expected diff --git a/tests/lib.rs b/tests/lib.rs index e86cc6b..c9689d7 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -284,12 +284,12 @@ fn test_os_specific_page() { fn test_markdown_rendering() { let testenv = TestEnv::new(); - testenv.add_entry("tar", include_str!("tar-markdown.expected")); + testenv.add_entry("which", include_str!("which-markdown.expected")); - let expected = include_str!("tar-markdown.expected"); + let expected = include_str!("which-markdown.expected"); testenv .command() - .args(&["-m", "tar"]) + .args(&["-m", "which"]) .assert() .success() .stdout(similar(expected)); @@ -427,7 +427,7 @@ fn test_pager_flag_enable() { testenv .command() - .args(&["--pager", "tar"]) + .args(&["--pager", "which"]) .assert() .success(); } @@ -618,7 +618,7 @@ fn test_pager_warning() { // Regular call should not show a "pager flag not available on windows" warning testenv .command() - .args(&["tar"]) + .args(&["which"]) .assert() .success() .stderr(contains("pager flag not available on Windows").not()); @@ -626,7 +626,7 @@ fn test_pager_warning() { // But it should be shown if the pager flag is true testenv .command() - .args(&["tar", "-p"]) + .args(&["which", "-p"]) .assert() .success() .stderr(contains("pager flag not available on Windows")); diff --git a/tests/tar-markdown.expected b/tests/tar-markdown.expected deleted file mode 100644 index ec9c7a7..0000000 --- a/tests/tar-markdown.expected +++ /dev/null @@ -1,37 +0,0 @@ -# tar - -> Archiving utility. -> Often combined with a compression method, such as gzip or bzip2. -> More information: . - -- [c]reate an archive and write it to a [f]ile: - -`tar cf {{target.tar}} {{file1}} {{file2}} {{file3}}` - -- [c]reate a g[z]ipped archive and write it to a [f]ile: - -`tar czf {{target.tar.gz}} {{file1}} {{file2}} {{file3}}` - -- [c]reate a g[z]ipped archive from a directory using relative paths: - -`tar czf {{target.tar.gz}} --directory={{path/to/directory}} .` - -- E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely: - -`tar xvf {{source.tar[.gz|.bz2|.xz]}}` - -- E[x]tract a (compressed) archive [f]ile into the target directory: - -`tar xf {{source.tar[.gz|.bz2|.xz]}} --directory={{directory}}` - -- [c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program: - -`tar caf {{target.tar.xz}} {{file1}} {{file2}} {{file3}}` - -- Lis[t] the contents of a tar [f]ile [v]erbosely: - -`tar tvf {{source.tar}}` - -- E[x]tract files matching a pattern from an archive [f]ile: - -`tar xf {{source.tar}} --wildcards "{{*.html}}"` diff --git a/tests/which-markdown.expected b/tests/which-markdown.expected new file mode 100644 index 0000000..36d3941 --- /dev/null +++ b/tests/which-markdown.expected @@ -0,0 +1,11 @@ +# which + +> Locate a program in the user's path. + +- Search the PATH environment variable and display the location of any matching executables: + +`which {{executable}}` + +- If there are multiple executables which match, display all: + +`which -a {{executable}}`