Commit Graph

19 Commits (ea2002a2e4c84943385c66637ef09544060a33a6)

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
John D Pell 8d1e802565 test: Use `${PWD}` instead of `$(pwd)` 2021-09-18 13:15:13 -07: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 f698261487
Updated to https://github.com/tralston/bats-file v0.3.0 2020-04-20 09:00:52 +02:00
Alex Thiessen 668306cae7
test/plugins/base: Run `myip` test
Test of `myip` was skipped, allegedly for it being slow. It's fast for
me (~400 ms), so enable it unconditionally.
2020-04-08 12:56:04 +02:00
Nils Winkler 395e9eff3c Added a couple more tests for mkcd
Also fixed the order of expected/actual for lsgrep test.
2017-10-17 08:18:58 +02:00
Nils Winkler da77e9506d Fixed buf test case that failed from time to time
Taking two timestamps (one before the function-under-test, and one
after), we minimize the chance of failure.
2017-10-17 08:18:58 +02:00
Nils Winkler e574de8f47 Moved testing for files to bats-file library functions 2017-10-14 18:02:04 +02:00
Nils Winkler 0aad8b4ab0 Fixed assert syntax 2017-06-24 17:31:31 +02:00
Ivan Povalyukhin 34670ea021 [tests] make setup function to create test dir per test 2015-05-03 18:11:27 -07:00
Ivan Povalyukhin f1de827622 [tests] added test for base plugin mkcd(); make mkcd() safe for directory names starting with a dash 2015-05-03 18:11:18 -07:00
Ivan Povalyukhin 067f851d79 [tests] added test for plugins base lsgrep() 2015-05-03 18:11:11 -07:00
Ivan Povalyukhin fb2134364e skip myip() function test - it is not determenistic, probably because of the network latency 2015-04-21 21:09:51 -07:00
Ivan Povalyukhin f420560986 make buf() to respect file attributes on file backup 2015-04-11 15:51:26 -07:00
Ivan Povalyukhin b3334bc9e5 adjust env vars in test_helper to make CI pass 2015-03-29 18:23:24 -07:00
Ivan Povalyukhin cbcdd66863 test base.plugin#pickfrom 2015-03-29 17:27:48 -07:00
Ivan Povalyukhin 839cf4429a start with tests for base.plugin 2015-03-29 16:31:05 -07:00