#!/usr/bin/env bats load test_helper @test "95-cleanup removes -debug packages whose package is gone, and keeps the rest" { # -Qqm lists the AUR packages; -Qq NAME prints what matches NAME, which for # herdr is herdr-bin, as it provides herdr stub pacman ' case "$1" in -Qqm) printf "%s\n" asdf-vm-debug cliamp cliamp-debug herdr-bin herdr-debug ;; -Qq) case "$2" in cliamp) echo cliamp ;; herdr) echo herdr-bin ;; *) exit 1 ;; esac ;; esac' stub sudo stub flatpak run bash "$REPO/updates.d/95-cleanup.sh" < /dev/null [ "$status" -eq 0 ] called sudo pacman -R --noconfirm asdf-vm-debug herdr-debug } @test "95-cleanup leaves -debug packages alone while their packages are installed" { stub pacman ' case "$1" in -Qqm) printf "%s\n" cliamp cliamp-debug ;; -Qq) [ "$2" = cliamp ] && echo cliamp ;; esac' stub sudo stub flatpak run bash "$REPO/updates.d/95-cleanup.sh" < /dev/null [ "$status" -eq 0 ] [ -z "$(grep 'pacman -R ' "$STUB_LOG")" ] }