#!/bin/bash

. ../init.sh

set -e

export ROOT=${as}/root
export Q_VDB=/

mktmpdir

test() {
	local num=$1; shift
	eval "$@" > list
	diff -u list ${as}/list${num}.good
	tend $? "$*"
}

# simple install check
test 01 "qlist -IC"

# simple files list
test 02 "qlist -C --showdebug cpio"

# symlink verbose list
test 03 "qlist -C --showdebug mtools -e -v"

# dir test
test 04 "qlist -C --showdebug mtools -d"

# obj test
test 05 "qlist -C --showdebug mtools -o"

# sym test
test 06 "qlist -C --showdebug mtools -s"

# SLOT test
test 07 "qlist -ICS"

# showdebug test #1
test 08 "qlist -C cpio"

# dir test
test 09 "qlist -C mtools -d"

# ver test
test 10 "qlist -Iv =mtools-4*"

# repo test
test 11 "qlist -ICR"

# slot with repo test
test 12 "qlist -ICSR"

# exact CAT/PN:slot::repo files list test
test 13 "qlist -Ce --showdebug app-arch/cpio:0::gentoo"

cleantmpdir

end
