Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Removed old `bash_unit` tests, re-structured test directories (will need to do that again when I start adding functional tests), moved unit test README.md and made some minor updates to it, added tests of createHeaderFooter() using the new shellspec library, and setup a bunch of stuff that's needed by shellspec. * Created some unit tests of createHeaderFooter using `shellspec`, updated top level README.md so it points to the correct location when it comes to the unit test README.md, removed the old GitHub actions files that used the old unit test library, broke out a test from one of the larger files, and fixed a number of bugs found while testing createHeaderFooter. Oh, I also made some updates to the createHeaderFooter doc. * Corrected typo in createdHeaderFooter doc and created tests of help option. * Moved location of unit tests so when I add functional tests in the future, I will just need to create a directory for them. Updated top level readme to reflect those changes. Moved unit test README.md for the same reason. Renamed unit test files to consistently follow a naming conv. Added a test of --prefix option of createHeaderFooter. Corrected name of output constants file and ensured new file name was updated where it's sourced. Cleaned up doc of createHeaderFooter by removing a bunch of stuff that's no longer true. Minor code refactor of createHeaderFooter so it looks cleaner. * Added first few tests of output() constants file. * Corrected tag name in createHeaderFooter unit test. Added some functions that are likely to be used in a bunch of places to spec_helper.sh. Finished creating tests of output() constants. * Updated test README.md files with updated/correct info. * Added logic to output() that allows it to differentiate between return code 141 and 142. Updated doc. Removed usage of a number of printf statments. Redirected error messages to stderr. Added logic that won't call date if not defined in environment. Added tr command to shellspec sandbox. * Added a number of unit tests of output(). Still need to add more. * Added last tests of output()'s message option and added some detail to the description of one of output()'s return codes. * Revampted project README.md files. * Updated test to follow standards documented in last commit. * Made what I think is the final change to the unit test struc. standard. Also updated existing tests to follow it. * Wrote a bunch more unit tests. Refactored how output() and createHeaderFooter() imports constants file so unit tests can mock it out. * Added unit tests, moved all sourcing of `output()` util files to `main.sh` to prevent double sourcing, coverted `createHeaderFooter()` to function, and refactored all existing unit tests (along with other stuff). shellspec config updates: - Added standard return value globals, link to spec helper portion of shellspec docs, and methods for checking if a value is posative or not negative to spec_helper.sh. `output()` unit test updates: - Updated top level `Define` section of all `output()` unit tests with more accurate line comment and mocked out `createHeaderFooter()` for all test files that contain only tests that should never use that method. - Removed `$` character from formatting characters returned by mockout out `createHeaderFooter()` because that character isn't supported. - Added unit test of `output()` when no arguments or options are provided to message unit test file. - Added unit tests that ensure `output()` handles `createHeaderFooter()` failures correctly. - Added unit tests that ensure `DEFAULT_INDENT` is handled correctly. - Moved some tests from the unit tests of the --prefix option that combined that with prefix to a seprate file. Think I might have also added some tests of that option combination. - Added unit tests of --pretty option. - Added unit tests of --header-footer option. - Added unit tests of --line-length option. - Added unit tests that ensure --pretty and --indent work together. - Mocked out `cat` command in unit tests of --header-footer and --pretty tests. Unit test updates: - Removed mocking out of `inScriptSouce()` from all unit tests of `createHeaderFooter()` because the file that method is in no longer sources anything. Also updated all unit tests of `createHeaderFooter()` to source `createHeaderFooter()` in a `BeforeAll` rather than having tests source the path that the file that contains `createHeaderFooter()` is in. This might speed up the tests, but it has to be done because `createHeaderFooter()` is now a function rather than just code in a file. - Refactored `createHeaderFooter_dateMocking_spec.sh` unit test so the structureis more simple. - Added tests of formatting character option of `createHeaderFooter()` in order to increase code coverage. - Added tests and refactored existing ones of line length option of `createHeaderFooter()` in order to better test boundry values and increase code coverage. - Corrected unit test that passes nothing to `createHeaderFooter()`. - Added test of prefix option of `createHeaderFooter()` in order to increase code coverage. `output()` udpates: - Moved sourcing of util files to `main.sh` to: avoid double sourcing, remove complexity from file that contains `output()`, and to make testing easier. - Now source `main.sh`. - Renamed varaible that stores log prefix so it's unique. This also prevents it from confilting with helper function(s). - Refactored how options that take numbers are parsed so they are more strict and will now catch invalid input and return the correct value. - Removed some error checking code because it's now handled by the option parsing code. - Refactored error checking bellow option parsing so it's easier to understand that if anything fails, the code will exit. - Refactored how `createHeaderFooter()` is called because it's now sourced rather than accessed directly. - Removed usage of `+=` to increase POSIX compatability. `createHeaderFooter()` updates: - `createHeaderFooter()` is now a function. This was done mostly to make testing easier, but it also cleans up the process of calling it. - I also removed all sourcing from the file that contains `createHeaderFooter()` because all sourcing of `output()` util files has been moved to a `main.sh` file so stuff isn't sourced more than once. Added defenition of DOD to top level README.md. - Removed sourcing because it's now handled by `main.sh` (which is sourced by `output()`). - Refactored how options that should be numbers are parsed so it's more strict. This allows invalid option values to be cought. `main.sh` created: - This file handles all sourcing of `output()` util files. - Sourced by `output()`. `.gitignore` now ignores coverage results as well as a temp file I sometimes use. * Removed use of `function` bashism. * Converted all instances of `${@}` to `$@` because the `{` and `}` arn't needed. * Apply suggestions from code review Minor doc changes. * Apply suggestions from code review * Update src/shell/shell_aliases * Apply suggestions from code review * Replaced TODOs in root README.md with correct text. * Replaced TODOs with text in functions README.md * Removed a TODO from the src README.md * Apply suggestions from code review
- Loading branch information