Commit Graph

219 Commits

Author SHA1 Message Date
John D Pell
97ef5a8087 test/run: lint 2022-01-08 08:29:13 -08:00
John D Pell
61e1d6aec2 lib/utilities: simplify test flow
This subshell is...wut
2022-01-08 08:29:13 -08:00
John D Pell
c35ed44cbf plugins/ruby: tests on Mac OS X
Test was failing only on Mac OS X for some reason, so refactor a little. It turned out to be due to explicitly setting `$HOME` *after* loading the plugin.
2022-01-08 08:29:13 -08:00
John D Pell
21a2198a12 test/theme: make fewer assumptions
Literally copying a line from the source to be tested is perhaps not the best way to test that code. 😉

That said, we do want to verify that the function was actually loaded.

TODO: actually test the function.
2022-01-08 08:29:13 -08:00
John D Pell
6030767b4e test/theme: load colors 2022-01-08 08:29:13 -08:00
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
b2279b7237 tests: quote paths 2022-01-08 08:29:13 -08:00
Noah Gorny
5d68fca7e5 Merge pull request #2008 from gaelicWizard/plugin-osx
Plugin/OSX: cleanup
2022-01-07 08:41:17 +02:00
Noah Gorny
c81c9dcc8c Merge pull request #1865 from NoahGorny/add-profile-subcommand
add profile subcommand
2022-01-03 14:00:39 +02:00
John D Pell
4abafc55ef tests: quote paths 2022-01-01 17:46:11 -08:00
cornfeedhobo
b7feb14404 skip go tests when go is not available 2021-09-29 18:16:52 -05:00
Noah Gorny
cd38f32d95 test: Fix completion tests and add profile completion ones 2021-09-29 00:30:24 +03:00
Noah Gorny
4c4b138671 tests: Add more bash-it profile tests 2021-09-29 00:30:24 +03:00
Noah Gorny
b2ee5f96a5 test: helpers: Add profile command tests 2021-09-29 00:30:24 +03: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
John D Pell
476fcb4325 lib/theme: new _bash_it_appearance_scm_init()
Wrap init code in a function and call the function immediately. Several plugins do this, and it allows us to more easily implement a hooks-based system in the future.

Alsö, avoid external binary `which`. Use built-in `type -P` instead. Uppercase `-P` forces a path search to avoid hashed matches and functions/aliases and whatnot.
2021-09-11 10:22:17 -07:00
John D Pell
8c0860588d themes/base: don't invoke svn if possible
If we are specifically in the situation #1612, then check for a working `svn` command. If we're not in that situation, then don't waste time on it.
2021-09-11 00:02:27 -07:00
John D Pell
3654198deb Tests for 'default' prefix 2021-08-26 14:11:41 -07:00
Noah Gorny
02f6654841 test: Add bash-it help plugins test 2021-03-21 22:07:24 +02:00
Noah Gorny
1fbd91ebf9 Merge pull request #1824 from cornfeedhobo/goenv-go
Ensure goenv and go play together well
2021-02-06 00:14:07 +02:00
cornfeedhobo
e690f21e4e Ensure goenv and go play together well
This PR seeks to address several issues surrounding the go and goenv plugins.
The nature of goenv allows for a situation where the initial shell does not
point to a working go binary, and instead at the included shim script. The
result is that one must run reload after moving to a project directory with a
version file, however in doing so, PATH is updated, requiring they exit the
shell or risk lookup collisions and unexpected behavior.

This is solved by using preexec to check the version before changing
directories and restarting the shell if the version has changed. The exec
pattern is copied from _bash-it-restart, but is edited to support this specific
use case.

Additionally, tests have been uploaded and these are now being linted.
2021-02-04 23:51:17 -06: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
Noah Gorny
0d0fde9904 Merge pull request #1813 from NoahGorny/improve-test-helper
test: helper: cite plumbing metadata
2021-01-28 16:08:03 +02:00
Noah Gorny
49cf84c4fe test: helper: cite plumbing metadata 2021-01-23 23:04:29 +02:00
Noah Gorny
6b3788051f test: plugin: xterm: Use correct _command_exists invocation 2021-01-23 23:03:41 +02:00
buhl
29855ed1e6 Adding preexec as a vendored library
Added a vendored lib loading routine in bash-it.sh
Added documentation on how to vendor libs in bash-it
Added and fixed plugins using preexec
Added tests for two plugins
Removed the old preexec lib
2021-01-23 18:31:18 +01:00
Noah Gorny
b19c2b969f test: Change alias-completion completion file to capistrano 2020-12-27 17:12:22 +02:00
Noah Gorny
f5753e4416 test: Add test for aliases rm for alias_completion 2020-12-14 01:21:00 +02:00
egvimo
3019dc331d Add option to append template to existing config (#1723)
* Add option to append template to existing config

* Add test for append-to-config option

Co-authored-by: Egor Moor <egor.moor@edag-ps.com>
2020-12-11 16:32:23 +02:00
Noah Gorny
864970bcd2 docs: Transition md files to support new rtd format 2020-11-06 19:16:56 +02:00
Noah Gorny
b14a38fec9 ci: Add pre-commit run and remove trailling spaces 2020-10-28 11:51:04 +02:00
Noah Gorny
3838f12498 Add tests for _binary_exists 2020-10-21 11:02:55 +03:00
Noah Gorny
c387517122 Merge pull request #1626 from NoahGorny/update-to-stable-or-unstable
bash-it update to stable or dev
2020-10-16 14:16:06 +03:00
Noah Gorny
fc17169b1c test: Add completion test for -s --silent flag 2020-10-13 14:42:02 +03:00
Noah Gorny
1bdcacf242 completion: Update completion for new bash-it update
Also fix the update completion test
2020-10-13 14:42:02 +03:00
Noah Gorny
f4279e63c1 Add bash-it restart command
Also add completion and completion tests
2020-10-12 15:29:36 +03:00
Travis Swicegood
ac3957393e Update tests so github-cli is expected 2020-10-10 02:39:02 +03:00
Ahmad Assaf
95b60098cd Update helpers.bats
Fix the `assert_success` by adding the required `run`
2020-09-24 05:20:04 -07:00
cornfeedhobo
f40bfa80f1 system completion nitpicks
- General cleanup of system completion
- Use homebrew's completion loading script instead
- Deprecate completions covered by system
- Adjust load priority of brew to happen after system
2020-09-21 09:07:09 -05:00
Nils Winkler
03e9124edb Fixed test execution 2020-08-05 10:36:29 +02:00
Nils Winkler
2f91e95af6 Adding log library to search tests
This might help with #1635.
2020-08-04 10:58:25 +02:00
Nils Winkler
43ef48544d Merge pull request #1627 from NoahGorny/fix-alias-completion-plugin
plugins: Fix quotes around prec_word agruments
2020-07-15 08:54:56 +02:00
Noah Gorny
72dbfd2480 lib: log: Insert log level before message prefix
Also fix tests accordinly
2020-07-02 21:11:40 +03:00
Noah Gorny
3069af37e0 tests: Include lib log 2020-07-02 21:11:40 +03:00
Noah Gorny
e6ebcda608 log: Fix logging to comply with the tests 2020-07-02 21:11:40 +03:00
Noah Gorny
0053f27820 test: Add alias-completion plugin test 2020-06-28 11:37:08 +03:00
Noah Gorny
9a23725ce0 log: Add BASH_IT_LOG_PREFIX option
Also add a new test to check it
2020-06-25 00:16:16 +03:00
Noah Gorny
5263f5ac59 test: Add lib log basic testing 2020-06-23 15:59:14 +03:00