Skip to content

Commit

Permalink
chore(types) adds tests and additional changelog entry
Browse files Browse the repository at this point in the history
closes #313
  • Loading branch information
Tieske committed Jul 30, 2020
1 parent 07b1176 commit 106dcfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- `pretty.write`: now also sorts non-string keys [#319](https://github.com/Tieske/Penlight/pull/319)
- `stringx.count` has an extra option to allow overlapping matches
[#326](https://github.com/Tieske/Penlight/pull/326)
- added an extra changelog entry for `types.is_empty` on the 1.6.0 changelog, due
to additional fixed behaviour not called out appropriately [#313](https://github.com/Tieske/Penlight/pull/313)

### Fixes

Expand Down Expand Up @@ -39,7 +41,7 @@
- `utils.raise` changed the global `on_error`-level when passing in bad arguments
- `utils.writefile` now checks and returns errors when writing
- `compat.execute` now handles the Windows exitcode -1 properly
- `types.is_empty` would return true on spaces always, indepedent of the parameter
- `types.is_empty` would return true on spaces always, independent of the parameter
- `types.to_bool` will now compare case-insensitive for the extra passed strings
- `app.require_here` will now properly handle an absolute base path
- `stringx.split` will no longer append an empty match if the number of requested
Expand Down Expand Up @@ -71,6 +73,7 @@
- Fixed `pl.import_into` not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed `types.is_empty` returning `true` on tables containing `false` key (#267).
- Fixed `types.is_empty` returning `true` if not a nil/table/string
- Fixed `test.assertraise` throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed `test.assertraise` not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
Expand Down
11 changes: 10 additions & 1 deletion tests/test-types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,16 @@ asserteq(types.is_empty(""),true)
asserteq(types.is_empty(" ",true),true)
asserteq(types.is_empty(" "),false)
asserteq(types.is_empty(true),true)
asserteq(types.is_empty(42),true)
-- Numbers
asserteq(types.is_empty(0), true)
asserteq(types.is_empty(20), true)
-- Booleans
asserteq(types.is_empty(false), true)
asserteq(types.is_empty(true), true)
-- Functions
asserteq(types.is_empty(print), true)
-- Userdata
asserteq(types.is_empty(newproxy()), true)

-- a more relaxed kind of truthiness....
asserteq(types.to_bool('yes'),true)
Expand Down

0 comments on commit 106dcfd

Please sign in to comment.