https://github.com/manicmaniac/assert.awk
An assertion library for awk.
https://github.com/manicmaniac/assert.awk
Last synced: 3 months ago
JSON representation
An assertion library for awk.
- Host: GitHub
- URL: https://github.com/manicmaniac/assert.awk
- Owner: manicmaniac
- License: mit
- Archived: true
- Created: 2015-02-24T13:01:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-24T13:54:48.000Z (about 10 years ago)
- Last Synced: 2025-01-24T20:23:43.650Z (4 months ago)
- Language: Awk
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# assert.awk
---
## Introduction
An assertion library for awk.
### Usage
1. First, download this library.
git clone https://github.com/manicmaniac/assert.awk
2. Second, write your assertions.
3. Execute awk with arguments below.
awk [-v BLOCK_ASSERTIONS] -f assert.awk (-f | '')
Note: If you use `gawk >= 4.0` or `igawk`, `@include "assert.awk"` may be useful.
## API
### Functions
#### `assert_equals(actual, expected, [message])`
Assert `actual` equals `expected`.
If an assertion failed, `message` will be dislayed and exit with status code `1`.
#### `assert_true(actual, [message])`
Assert `actual` is "truthy".
Note: If an expression is evaluated as true, it's "truthy".
If an assertion failed, `message` will be dislayed and exit with status code `1`.
#### `assert_true(actual, [message])`
Assert `actual` is "falsy".
Note: If an expression is evaluated as false, it's "falsy".
If an assertion failed, `message` will be dislayed and exit with status code `1`.
#### `assert_fail([message])`
Display `message` and exit with status code `1`.
### Variables
#### `BLOCK_ASSERTIONS`
If awk passed the argument `-v BLOCK_ASSERTIONS=1`, any assertions will not be evaluated.
### Version
Now 0.1.0.
### License
This program is licensed under the [MIT License](http://opensource.org/licenses/MIT).
See [LICENSE.txt](LICENSE.txt) for more information.