plugin/battery: fix tests

pull/2061/head
John D Pell 2022-02-20 13:26:55 -08:00 committed by John D Pell
parent 604f9b0baa
commit 789ede9ef3
1 changed files with 2 additions and 3 deletions

View File

@ -196,12 +196,11 @@ function setup_upower {
percent="$1" percent="$1"
BAT0="/org/freedesktop/UPower/devices/battery_BAT$RANDOM" BAT0="/org/freedesktop/UPower/devices/battery_BAT$RANDOM"
function upower { function upower {
case $1 in case $1 in
'-e'|'--enumerate') '-e'|'--enumerate')
echo "$BAT0" # don't just `echo` twice because `grep` will close the pipe after matching the first line...
echo "/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery" echo "$BAT0"$'\n'"/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery"
;; ;;
'-i'|'--show-info') '-i'|'--show-info')
if [[ $2 == "$BAT0" ]] if [[ $2 == "$BAT0" ]]