-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added README.md for documenting unit test stuff. * Started refactoring top level README.md so it mainly just links to other README.md files. I also created a README.md file in the src directory, but didn't fill it out.
- Loading branch information
1 parent
fb7e1cd
commit 314492d
Showing
6 changed files
with
79 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,41 @@ | ||
# Bash Base | ||
|
||
I create symbolic soft links to a local clone of this repo in my local environment. I provide no warranties. | ||
I create symbolic links to a local clone of this repo in my local environment. This repo provides almost all environment files I use on my machines. I provide no warranties. | ||
|
||
## Setup | ||
|
||
Run `environment_setup.sh` file to remove your current bash file(s) and directory(ies), any file in your home directory that starts with `.bash*` or directory named `bash`, and replace them with the bash files from this repo. | ||
|
||
## Functions | ||
## Functionality | ||
|
||
This secton contains basic info regarding the bash function(s) that are included in this repo. Most info is stored in the same file as the code and may be accessed by calling the function and passing in `-h` or `--help`. | ||
This section covers what functionality is provided by this repo. For more info, see the `README.md` files in the directory that's closest to the code you want to know more about or use the links from this section. In other words, this section is just for letting you know what functionality exists. | ||
|
||
### log | ||
### Source Code | ||
|
||
Bash function that produces formatted logs to stdout. | ||
Section covers where to go to find out more about the functionality provided by the code in this repo. There is another section that covers tests. | ||
|
||
#### Location | ||
#### [Basic Environment Setup and Configuration](src/README.md) | ||
|
||
bash/functions/log.sh | ||
There is an environment setup script here as well as the base file(s) used when configuring a POSIX complient environment. The `README.md` linked to above contains more info. | ||
|
||
#### Example Usage | ||
Please note that an attempt is made to ensure everything is POSIX complient, but most of my systems run `bash`. | ||
|
||
```sh | ||
declare infoLvl="-i -c=example_script" | ||
#### [Advanced Environment Configuration](src/bash/README.md) | ||
|
||
log $infoLvl -m="Requesting input from user..." | ||
printf "Enter number you'd like to count to: " | ||
read userVar | ||
log $infoLvl -m="User entered: '$userVar'" | ||
These file(s) are used (sourced) by the files covered by [Basic Environment Setup and Configuration](#basic-environment-setup-and-configuration). The `README.md` linked to above contains more info. | ||
|
||
for (( i=1; i<=$userVar; i++)); do | ||
echo "$i" | ||
done | ||
``` | ||
#### [POSIX Functions](src/bash/functions/README.md) | ||
|
||
### output | ||
These file(s) contain POSIX complient function(s). The `README.md` linked to above contains more info. | ||
|
||
TODO | ||
|
||
#### Location | ||
#### [POSIX Function Constants](src/bash/functions/constants/README.md) | ||
|
||
bash/functions/output.sh | ||
These file(s) contain constants used by the POSIX functions in the parient directory. The `README.md` linked to above contains more info. | ||
|
||
#### Example Usage | ||
### Tests | ||
|
||
TODO | ||
|
||
### backUp | ||
|
||
Bash script that copies files and directories from user's home directory to another location. | ||
|
||
#### Location | ||
|
||
bash/functions/backUp.sh | ||
|
||
#### Example Usage | ||
|
||
```sh | ||
backUp | ||
``` | ||
#### [Unit Tests](tests/unit/README.md) | ||
|
||
The `README.md` linked to above contains more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# POSIX Functions, Globals, and Constants | ||
|
||
TODO | ||
|
||
## POSIX Functions | ||
|
||
TODO | ||
|
||
### `backUp` | ||
|
||
Bash script that copies files and directories from user's home directory to another location. | ||
|
||
### `checkRequiredOpts` | ||
|
||
TODO | ||
|
||
### `output` | ||
|
||
TODO | ||
|
||
### `log` | ||
|
||
Bash function that produces formatted logs to stdout. | ||
|
||
#### `log` Example Usage | ||
|
||
```sh | ||
declare -r infoLvl="-i -c=example_script" | ||
|
||
log $infoLvl -m="Requesting input from user..." | ||
printf "Enter number you'd like to count to: " | ||
read userVar | ||
log $infoLvl -m="User entered: '$userVar'" | ||
|
||
for (( i=1; i<=$userVar; i++)); do | ||
log $infoLvl -m="$i" | ||
done | ||
``` | ||
|
||
## POSIX Globals | ||
|
||
TODO | ||
|
||
## POSIX Constants | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Unit Testing | ||
|
||
## Unit Testing Goals | ||
|
||
Unit tests should: | ||
|
||
- Test the smallest possible unit of code in a single way. | ||
- Ensure no code outside of the function under test, or file if not encapelated in a function, should be executed. | ||
- Be broken up into files with tests that exersies the same functionality. | ||
|
||
## Organization | ||
|
||
Unit tests are stored in directories with the same name as the Code Under Test (COT) in the `tests` directory (`<currentDir>/tests/<cotName>/test_<cotName>*.sh`). |