Commit Graph

22 Commits (4ec1b5f3e767fc48b977cd08e7d23218c5b9ee0f)

Author SHA1 Message Date
John D Pell da6b27166f tests: new file `test_helper_libs.bash`
For testing non-core files, just `load ../test_helper_libs` after `load ../test_helper` instead of trying to guess which libs must be loaded, in which order, for testing to succeed.

`_command_exists` spews log messages, so our test log is littered with `_log_debug not found`. This fixes that too.
2022-01-08 08:29:13 -08:00
John D Pell 9dcbeec7ad tests: test_helper already loads `composure.sh`
...and `cite()`s metadata
2022-01-08 08:29:13 -08:00
John D Pell c2c76a380a
plugin/base: improvements (#1930)
* plugins/base: code style improvements

Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c.

* plugins/base: conditional function definitions

Instead of functions failing when required tools aren't installed, just don't define the function.
Alsö, don't redefine del() if it already exists.

* plugins/base: rewrite `usage()`

Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.

* plugins/base: revamp `quiet()`

New implementation that is even quieter.

* plugins/base: `myip()`

* plugins/base: `pickfrom()`

* plugins/base: `passgen()`

Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.

* plugins/base: `mkcd()`

* plugins/base: `mkiso()`

* plugins/base: remove `banish-cookies()`

Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function...

* plugins/base: `lsgrep` is SC2010

The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010.

Alsö, s/`$*`/`$@`

* plugins/base: `mkiso()`

Expressly handle unbound parameters.

* plugins/base: remove `command_exists`

* plugin/base: lint SC2154 && SC2144

Newly undisabled `shellcheck` rules

* plugin/base: import libs for tests

* plugin/base: `shfmt`

Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
2021-09-28 15:13:27 +03:00
buhl 49d7d2e8c4 Getting Bash-it to use the vendored composure
Fixed tests
Fixed install.sh and bash_it.sh
Added gitattributes to the vendor folder
Changed documentation
2021-02-02 16:34:04 +01:00
Nils Winkler 31990490fa Added test for the "no" energy tool case 2017-11-02 06:46:01 +01:00
Nils Winkler 5ab0cc5388 Fixed ioreg - no battery test case 2017-11-02 06:46:01 +01:00
Nils Winkler 7ea1a58216 Added comments on the test functions 2017-11-02 06:46:01 +01:00
Nils Winkler 629b8522e5 Ensuring that output is always two digits at least
Show "04" instead of just "4".
2017-11-02 06:46:01 +01:00
Nils Winkler 7602b1da32 Added tests for WMIC 2017-11-02 06:46:01 +01:00
Nils Winkler 601202e816 Simplified ioreg, added tests for no status 2017-11-02 06:46:01 +01:00
Nils Winkler 486c9e1382 Consolidated cases for acpi 2017-11-02 06:46:01 +01:00
Nils Winkler 3aed38c79f Updated acpi tests
Trying to cover the currently implemented tests, but I don't have a
system with acpi available for testing. Relying on assumptions so far.
2017-11-02 06:46:01 +01:00
Nils Winkler 812f49e457 Started first tests for acpi command 2017-11-02 06:46:01 +01:00
Nils Winkler a4824cc8c8 Changed pmset test to use printf 2017-11-02 06:46:01 +01:00
Nils Winkler b7b8a0afe0 Completed tests for upower command 2017-11-02 06:46:01 +01:00
Nils Winkler 5ab23e3ca0 Added test cases for acpi, upower and ioreg, need to fill in data
The one for ioreg works fine, the others currently fail.
2017-11-02 06:46:01 +01:00
Nils Winkler b4c6029706 Made setup function for _command_exists generic 2017-11-02 06:46:01 +01:00
Nils Winkler 28c41efcbc Simplified setup fixture for pmset/_command_exists 2017-11-02 06:46:01 +01:00
Nils Winkler c221648a7f Refactored setup function for pmset 2017-11-02 06:46:01 +01:00
Nils Winkler c8d86858fd Added setup function for _command_exists that works for pmset 2017-11-02 06:46:01 +01:00
Nils Winkler d0b3205de0 Added an additional test case and a fix for using the pmset command
The other commands still need to be mocked and tested/fixed, too.
2017-11-02 06:46:01 +01:00
Nils Winkler ef28b2788b Added test cases for battery_percentage with pmset
Need to figure out way to ensure that pmset is used every time...
2017-11-02 06:46:01 +01:00