|
|
@ -69,7 +69,7 @@ function testBatterySegmentIfBatteryIsLowWhileDischargingOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 4%; discharging; 0:05 remaining present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{009}🔋 %f%F{009}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
|
|
@ -77,7 +77,7 @@ function testBatterySegmentIfBatteryIsLowWhileChargingOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 4%; charging; 0:05 remaining present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{011}🔋 %f%F{011}4%% (0:05) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
|
|
|
function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
|
|
@ -85,7 +85,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileDischargingOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 98%; discharging; 3:57 remaining present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{015%}🔋 %f%F{015}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{015}🔋 %f%F{015}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
|
|
|
function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
|
|
@ -93,7 +93,7 @@ function testBatterySegmentIfBatteryIsAlmostFullWhileChargingOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 98%; charging; 3:57 remaining present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{011%}🔋 %f%F{011}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{011}🔋 %f%F{011}98%% (3:57) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsFullOnOSX() {
|
|
|
|
function testBatterySegmentIfBatteryIsFullOnOSX() {
|
|
|
@ -101,7 +101,7 @@ function testBatterySegmentIfBatteryIsFullOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'AC Power'
|
|
|
|
makeBatterySay "Now drawing from 'AC Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 99%; charged; 0:00 remaining present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 99%; charged; 0:00 remaining present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{002%}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{002}🔋 %f%F{002}99%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
|
|
|
function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
|
|
@ -109,42 +109,42 @@ function testBatterySegmentIfBatteryIsCalculatingOnOSX() {
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
makeBatterySay "Now drawing from 'Battery Power'
|
|
|
|
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
|
|
|
|
-InternalBattery-0 (id=1234567) 99%; discharging; (no estimate) present: true"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{015%}🔋 %f%F{015}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{015}🔋 %f%F{015}99%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileDischargingOnLinux() {
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
makeBatterySay "4" "Discharging"
|
|
|
|
makeBatterySay "4" "Discharging"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{009%}🔋 %f%F{009}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{009}🔋 %f%F{009}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsLowWhileChargingOnLinux() {
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
makeBatterySay "4" "Charging"
|
|
|
|
makeBatterySay "4" "Charging"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{011%}🔋 %f%F{011}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{011}🔋 %f%F{011}4%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWhileDischargingOnLinux() {
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
makeBatterySay "10" "Discharging"
|
|
|
|
makeBatterySay "10" "Discharging"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{015%}🔋 %f%F{015}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{015}🔋 %f%F{015}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWhileChargingOnLinux() {
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
makeBatterySay "10" "Charging"
|
|
|
|
makeBatterySay "10" "Charging"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{011%}🔋 %f%F{011}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{011}🔋 %f%F{011}10%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsFullOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsFullOnLinux() {
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
local OS='Linux' # Fake Linux
|
|
|
|
makeBatterySay "100" "Full"
|
|
|
|
makeBatterySay "100" "Full"
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{002%}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{002}🔋 %f%F{002}100%% " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
|
|
|
function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
|
|
@ -155,7 +155,7 @@ function testBatterySegmentIfBatteryIsNormalWithAcpiEnabledOnLinux() {
|
|
|
|
# For running on Mac, we need to mock date :(
|
|
|
|
# For running on Mac, we need to mock date :(
|
|
|
|
[[ -f /usr/local/bin/gdate ]] && alias date=gdate
|
|
|
|
[[ -f /usr/local/bin/gdate ]] && alias date=gdate
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{015}🔋 %f%F{015}50%% (1:38) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
|
|
|
|
|
|
|
|
unalias date &>/dev/null
|
|
|
|
unalias date &>/dev/null
|
|
|
|
# unaliasing date fails where it was never aliased (e.g. on Linux).
|
|
|
|
# unaliasing date fails where it was never aliased (e.g. on Linux).
|
|
|
@ -171,7 +171,7 @@ function testBatterySegmentIfBatteryIsCalculatingWithAcpiEnabledOnLinux() {
|
|
|
|
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
|
|
|
|
echo "echo 'Batter 0: Discharging, 50%, rate remaining'" > ${FOLDER}/usr/bin/acpi
|
|
|
|
chmod +x ${FOLDER}/usr/bin/acpi
|
|
|
|
chmod +x ${FOLDER}/usr/bin/acpi
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{000} %F{015%}🔋 %f%F{015}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
assertEquals "%K{000} %F{015}🔋 %f%F{015}50%% (...) " "$(prompt_battery left 1 false ${FOLDER})"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
source shunit2/shunit2
|
|
|
|
source shunit2/shunit2
|