[pacman-dev] [PATCH 1/2] Add tests for native and foreign flags

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Oct 24 09:13:47 EDT 2013


On 10/21/13 at 03:10am, Chirantan Ekbote wrote:
> Add tests to check that pacman recognizes -Qm and -Qn as valid options
> and -Qmn as an invalid option
> 
> Signed-off-by: Chirantan Ekbote <chirantan.ekbote at gmail.com>
> ---
>  test/pacman/tests/TESTS        |  3 +++
>  test/pacman/tests/pacman006.py | 14 ++++++++++++++
>  test/pacman/tests/pacman007.py | 10 ++++++++++
>  test/pacman/tests/pacman008.py |  5 +++++
>  4 files changed, 32 insertions(+)
>  create mode 100644 test/pacman/tests/pacman006.py
>  create mode 100644 test/pacman/tests/pacman007.py
>  create mode 100644 test/pacman/tests/pacman008.py
> 
> diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
> index fc6a7e8..0a0457a 100644
> --- a/test/pacman/tests/TESTS
> +++ b/test/pacman/tests/TESTS
> @@ -68,6 +68,9 @@ TESTS += test/pacman/tests/pacman002.py
>  TESTS += test/pacman/tests/pacman003.py
>  TESTS += test/pacman/tests/pacman004.py
>  TESTS += test/pacman/tests/pacman005.py
> +TESTS += test/pacman/tests/pacman006.py
> +TESTS += test/pacman/tests/pacman007.py
> +TESTS += test/pacman/tests/pacman008.py
>  TESTS += test/pacman/tests/provision001.py
>  TESTS += test/pacman/tests/provision002.py
>  TESTS += test/pacman/tests/provision003.py
> diff --git a/test/pacman/tests/pacman006.py b/test/pacman/tests/pacman006.py
> new file mode 100644
> index 0000000..9a2ea92
> --- /dev/null
> +++ b/test/pacman/tests/pacman006.py
> @@ -0,0 +1,14 @@
> +self.description = "Test command line option (-Qm)"
> +
> +p = pmpkg("foobar")
> +p.files = ["bin/foobar"]
> +self.addpkg2db("local", p)
> +
> +p2 = pmpkg("dummy")
> +p2.files = ["bin/dummy",
> +            "usr/man/man1/dummy.1"]
> +self.addpkg2db("sync", p2)
> +
> +self.args = "-Qm"
> +
> +self.addrule("PACMAN_RETCODE=0")
> diff --git a/test/pacman/tests/pacman007.py b/test/pacman/tests/pacman007.py
> new file mode 100644
> index 0000000..a8a2701
> --- /dev/null
> +++ b/test/pacman/tests/pacman007.py
> @@ -0,0 +1,10 @@
> +self.description = "Test command line option (-Qn)"
> +
> +p = pmpkg("foobar")
> +p.files = ["bin/foobar"]
> +self.addpkg2db("local", p)
> +self.addpkg2db("sync", p)
> +
> +self.args = "-Qn"
> +
> +self.addrule("PACMAN_RETCODE=0")

The filelists for both of these are unnecessary and we should probably
go ahead and test the output to make sure the correct package is being
listed.

> diff --git a/test/pacman/tests/pacman008.py b/test/pacman/tests/pacman008.py
> new file mode 100644
> index 0000000..589b2ba
> --- /dev/null
> +++ b/test/pacman/tests/pacman008.py
> @@ -0,0 +1,5 @@
> +self.description = "Test invalid combination of command line options (-Qmn)"
> +
> +self.args = "-Qmn"
> +
> +self.addrule("PACMAN_RETCODE=1")

You need to test the output here too to make sure we're getting the
correct error.  pacman also returns 1 if no packages match (which is
guaranteed with -mn) or no sync repos are configured.

> -- 
> 1.8.4.1


More information about the pacman-dev mailing list