Skip to content

Commit

Permalink
lib/battery: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelicWizard committed Feb 9, 2022
1 parent 8ef853c commit 0ecf527
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions test/lib/battery.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
load ../test_helper
load ../test_helper_libs

load ../../plugins/available/battery.plugin
load ../../lib/battery

# Sets up the `_command_exists` function so that it only responds `true` if called with
# the name of the function that was passed in as an argument to `setup_command_exists`.
Expand Down Expand Up @@ -37,7 +37,7 @@ function setup_command_exists {
# no tool
#

@test 'plugins battery: battery-percentage with no tool' {
@test 'lib battery: battery-percentage with no tool' {
setup_command_exists "fooooo"

run battery_percentage
Expand All @@ -59,7 +59,7 @@ function setup_pmset {
}
}

@test 'plugins battery: battery-percentage with pmset, 100%' {
@test 'lib battery: battery-percentage with pmset, 100%' {
setup_command_exists "pmset"

setup_pmset "100%"
Expand All @@ -68,7 +68,7 @@ function setup_pmset {
assert_output "100"
}

@test 'plugins battery: battery-percentage with pmset, 98%' {
@test 'lib battery: battery-percentage with pmset, 98%' {
setup_command_exists "pmset"

setup_pmset "98%"
Expand All @@ -77,7 +77,7 @@ function setup_pmset {
assert_output "98"
}

@test 'plugins battery: battery-percentage with pmset, 98.5%' {
@test 'lib battery: battery-percentage with pmset, 98.5%' {
setup_command_exists "pmset"

setup_pmset "98.5%"
Expand All @@ -86,7 +86,7 @@ function setup_pmset {
assert_output "98"
}

@test 'plugins battery: battery-percentage with pmset, 4%' {
@test 'lib battery: battery-percentage with pmset, 4%' {
setup_command_exists "pmset"

setup_pmset "4%"
Expand All @@ -95,7 +95,7 @@ function setup_pmset {
assert_output "04"
}

@test 'plugins battery: battery-percentage with pmset, no status' {
@test 'lib battery: battery-percentage with pmset, no status' {
setup_command_exists "pmset"

setup_pmset ""
Expand All @@ -122,7 +122,7 @@ function setup_acpi {
}
}

@test 'plugins battery: battery-percentage with acpi, 100% Full' {
@test 'lib battery: battery-percentage with acpi, 100% Full' {
setup_command_exists "acpi"

setup_acpi "100%" "Full"
Expand All @@ -131,7 +131,7 @@ function setup_acpi {
assert_output "100"
}

@test 'plugins battery: battery-percentage with acpi, 98% Charging' {
@test 'lib battery: battery-percentage with acpi, 98% Charging' {
setup_command_exists "acpi"

setup_acpi "98%" "Charging"
Expand All @@ -140,7 +140,7 @@ function setup_acpi {
assert_output "98"
}

@test 'plugins battery: battery-percentage with acpi, 98% Discharging' {
@test 'lib battery: battery-percentage with acpi, 98% Discharging' {
setup_command_exists "acpi"

setup_acpi "98%" "Discharging"
Expand All @@ -149,7 +149,7 @@ function setup_acpi {
assert_output "98"
}

@test 'plugins battery: battery-percentage with acpi, 98% Unknown' {
@test 'lib battery: battery-percentage with acpi, 98% Unknown' {
setup_command_exists "acpi"

setup_acpi "98%" "Unknown"
Expand All @@ -158,7 +158,7 @@ function setup_acpi {
assert_output "98"
}

@test 'plugins battery: battery-percentage with acpi, 4% Charging' {
@test 'lib battery: battery-percentage with acpi, 4% Charging' {
setup_command_exists "acpi"

setup_acpi "4%" "Charging"
Expand All @@ -167,7 +167,7 @@ function setup_acpi {
assert_output "04"
}

@test 'plugins battery: battery-percentage with acpi, 4% no status' {
@test 'lib battery: battery-percentage with acpi, 4% no status' {
setup_command_exists "acpi"

setup_acpi "4%" ""
Expand All @@ -176,7 +176,7 @@ function setup_acpi {
assert_output "04"
}

@test 'plugins battery: battery-percentage with acpi, no status' {
@test 'lib battery: battery-percentage with acpi, no status' {
setup_command_exists "acpi"

setup_acpi "" ""
Expand All @@ -200,7 +200,7 @@ function setup_upower {
}
}

@test 'plugins battery: battery-percentage with upower, 100%' {
@test 'lib battery: battery-percentage with upower, 100%' {
setup_command_exists "upower"

setup_upower "100.00%"
Expand All @@ -209,7 +209,7 @@ function setup_upower {
assert_output "100"
}

@test 'plugins battery: battery-percentage with upower, 98%' {
@test 'lib battery: battery-percentage with upower, 98%' {
setup_command_exists "upower"

setup_upower "98.4567%"
Expand All @@ -218,7 +218,7 @@ function setup_upower {
assert_output "98"
}

@test 'plugins battery: battery-percentage with upower, 98.5%' {
@test 'lib battery: battery-percentage with upower, 98.5%' {
setup_command_exists "upower"

setup_upower "98.5%"
Expand All @@ -227,7 +227,7 @@ function setup_upower {
assert_output "98"
}

@test 'plugins battery: battery-percentage with upower, 4%' {
@test 'lib battery: battery-percentage with upower, 4%' {
setup_command_exists "upower"

setup_upower "4.2345%"
Expand All @@ -236,7 +236,7 @@ function setup_upower {
assert_output "04"
}

@test 'plugins battery: battery-percentage with upower, no output' {
@test 'lib battery: battery-percentage with upower, no output' {
setup_command_exists "upower"

setup_upower ""
Expand All @@ -260,7 +260,7 @@ function setup_ioreg {
}
}

@test 'plugins battery: battery-percentage with ioreg, 100%' {
@test 'lib battery: battery-percentage with ioreg, 100%' {
setup_command_exists "ioreg"

setup_ioreg "100%"
Expand All @@ -269,7 +269,7 @@ function setup_ioreg {
assert_output "100"
}

@test 'plugins battery: battery-percentage with ioreg, 98%' {
@test 'lib battery: battery-percentage with ioreg, 98%' {
setup_command_exists "ioreg"

setup_ioreg "98%"
Expand All @@ -278,7 +278,7 @@ function setup_ioreg {
assert_output "98"
}

@test 'plugins battery: battery-percentage with ioreg, 98.5%' {
@test 'lib battery: battery-percentage with ioreg, 98.5%' {
setup_command_exists "ioreg"

setup_ioreg "98.5%"
Expand All @@ -287,7 +287,7 @@ function setup_ioreg {
assert_output "98"
}

@test 'plugins battery: battery-percentage with ioreg, 4%' {
@test 'lib battery: battery-percentage with ioreg, 4%' {
setup_command_exists "ioreg"

setup_ioreg "4%"
Expand All @@ -296,7 +296,7 @@ function setup_ioreg {
assert_output "04"
}

@test 'plugins battery: battery-percentage with ioreg, no status' {
@test 'lib battery: battery-percentage with ioreg, no status' {
setup_command_exists "ioreg"

# Simulate that no battery is present
Expand All @@ -323,7 +323,7 @@ function setup_WMIC {
}
}

@test 'plugins battery: battery-percentage with WMIC, 100%' {
@test 'lib battery: battery-percentage with WMIC, 100%' {
setup_command_exists "WMIC"

setup_WMIC "100%"
Expand All @@ -332,7 +332,7 @@ function setup_WMIC {
assert_output "100"
}

@test 'plugins battery: battery-percentage with WMIC, 98%' {
@test 'lib battery: battery-percentage with WMIC, 98%' {
setup_command_exists "WMIC"

setup_WMIC "98%"
Expand All @@ -341,7 +341,7 @@ function setup_WMIC {
assert_output "98"
}

@test 'plugins battery: battery-percentage with WMIC, 98.5%' {
@test 'lib battery: battery-percentage with WMIC, 98.5%' {
setup_command_exists "WMIC"

setup_WMIC "98.5%"
Expand All @@ -350,7 +350,7 @@ function setup_WMIC {
assert_output "98"
}

@test 'plugins battery: battery-percentage with WMIC, 4%' {
@test 'lib battery: battery-percentage with WMIC, 4%' {
setup_command_exists "WMIC"

setup_WMIC "4%"
Expand All @@ -359,7 +359,7 @@ function setup_WMIC {
assert_output "04"
}

@test 'plugins battery: battery-percentage with WMIC, no status' {
@test 'lib battery: battery-percentage with WMIC, no status' {
setup_command_exists "WMIC"

setup_WMIC ""
Expand Down

0 comments on commit 0ecf527

Please sign in to comment.