Commit Graph

160 Commits

Author SHA1 Message Date
Alex Thiessen
9f3889c284 test: Make rsync optional
For bulk copying, `rsync` is used in test code, which is rather fast and
capable of saving needless write operations. The downside is that tests
fail when the tool is missing, which is the case with most minimal Linux
setups (e.g. containers or even Gnome installations of Debian).

Provide an alternative way for sufficiently fast copying by means of
`find -exec cp`. Measured total test time penalty is less than 0.5%.
Downside of needless write operations remains in case of fallback.
2020-05-11 02:30:10 +02:00
Nils Winkler
62bf3bf097 Fix search plugin tests
Had to move the `cite` definition up a couple of lines, since `_about`
is used in some of the tested plugins

Fixes #1582
2020-05-02 14:19:15 +02:00
Nils Winkler
cbe2986210 Updated test readme 2020-04-22 11:19:18 +02:00
Nils Winkler
e9467825ec Removed assert_link_exist function
This is now provided by the used version of bats-file.
2020-04-22 11:16:10 +02:00
Nils Winkler
543e49b759 Updated GNU parallel detection
Thanks to @rico-chet for the detection code!
2020-04-21 08:25:40 +02:00
Nils Winkler
9269c4445d Went back to the bats-file temp_make function
Switching to tralston/bats-file allowed to use temp_make on macOS.
2020-04-21 08:25:40 +02:00
Nils Winkler
eb6469096a Added the parallel test execution code from @rico-chet
See here: cd4a039215/test/run (L22)
2020-04-21 08:25:40 +02:00
Nils Winkler
bc433cd999 Fixing the mktemp function on Linux 2020-04-21 08:25:40 +02:00
Nils Winkler
818a95d79c Refactored test setup code
Removed the copy/paste code, moved it into a reusable function that can
be called from the `local_setup` function as needed. Also simplified the
handling of the $HOME variable since @rico-chet provided a better way of
doing this.
2020-04-21 08:25:40 +02:00
Nils Winkler
34993f5da3 Excluding enabled directory when setting up test fixtures 2020-04-21 08:25:40 +02:00
Nils Winkler
3093273425 Updated rsync command to work with latest version of bats-core 2020-04-21 08:25:39 +02: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
c003f0f342 test/plugins/go: Skip tests in absence of go
In case `go` is not installed, tests of the according plugin fail. It's
better to just skip them since `golang` isn't commonly installed on
`bash-it` developers' machines.

In CI environment, no tests should be skipped, so run them anyway.
2020-04-10 00:03:39 +00:00
Alex Thiessen
3d45f01728 test/test_helper: Don't use system/user git config
Git uses system-wide and user-wide configurations per default and these
can interfere with our tests. Keep `git` from using them by setting the
according environment variables.

This might also help with other tools which access user's home
directory.
2020-04-08 14:31:33 +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
John McBride
036c26dbed Update jump plugin
- remove z plugin
- remove fasd plugin
- update test that referenced fsad

Signed-off-by: John McBride <jpmmcbride@gmail.com>
2020-02-03 11:43:24 -07:00
cornfeedhobo
377f02714d Simplify multiple path support in go plugin (#1284)
* simplify wrapped pathmunge logic. update tests to account for cases with spaces in $PATH.
2019-11-20 08:49:34 +01:00
Nils Winkler
721412aa4c Merge pull request #1395 from zhao-li/toggle-able_commit_count
Toggle able commit count
2019-09-02 08:45:19 +02:00
Zhao Li
83be21ebb3 update tests to set flag appropriately 2019-07-08 13:33:14 -10:00
Zhao Li
49d8c8750a fix broken tests 2019-07-08 13:28:32 -10:00
Nils Winkler
792593c995 Merge pull request #1273 from kigster/kig/search/improved
Speed up bash-it Search & support exact matches
2019-01-14 09:05:02 +01:00
cornfeedhobo
1030c0e9e1 one more test ... why not 2018-12-06 17:11:13 -05:00
cornfeedhobo
3645305644 add go plugin tests and update list reversal logic 2018-12-06 17:07:03 -05:00
Konstantin Gredeskoul
09c2be9d6b Refactor (extract utilities + add tests) & more…
* Extracting common utilities into utilities.bash
 * Adding new tests for utilities
 * Relocating the cache file to be under $BASH_IT
 * Removing cache cleanup deferral code for now
 * Wiping the cache in local_setup in tests.
2018-11-23 16:40:35 -08:00
Konstantin Gredeskoul
baae0305b6 Speed up bash-it Search & support exact matches
This commit improves Bash-It search functionality in a couple of ways:

 * bash-it search (with no arguments) will print detailed help.
 * bash-it search now accepts terms prefixed with '@' sign, indicating an exact match.
 * bash-it search now performs smarter caching of the component listings/status

New search syntax is as follows:

   bash-it search [-|@]term1 [-|@]term2 [ --enable | --disable | --help ]
2018-11-19 11:55:36 -08:00
Piotr Rogoża
48e6888a38 Removed reload keyword from composure_keywords(), it is not needed 2018-04-21 19:15:50 +02:00
Piotr Rogoża
89d1661d23 Replaced reload section with proper function.
Added completion for reload.
Fixed order in completion
Added unit tests for completion
The variable BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE has to be unset.
2018-04-18 21:51:20 +02:00
Dan Wendorf
c5f2c408e7 SCM_CURRENT_USER supports accented characters
`tr 'A-Z' 'a-z'` will only convert non-accented characters. Switching to
`[:upper:]` and `[:lower:]` adds support for accents.
See https://github.com/koalaman/shellcheck/wiki/SC2018

Additionally, printf's character splitting does not support accented
characters, so output isn't as expected. Using bash's variable expansion
syntax instead will correctly get the full accented character.
2017-12-18 09:05:33 -08:00
Dan Wendorf
150e82b221 Refactor git functionality into githelpers.theme.bash
- Add unit tests around git functionality
2017-12-18 09:05:33 -08: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
d39d14b140 Refactored test run script so that you can run a single file
Call it like this:

test/run test/plugins/battery.plugin.bats

If called without any parameters, all of the tests are run.
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
Nils Winkler
e729826ec0 Fixed some shellcheck warnings 2017-10-17 08:18:58 +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