aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_format_spec.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.format: Ensure metatable __tostring results are also sanitizedKim Alvefur2021-12-131-0/+16
|
* util.format: Fix some formats expecting positive numbers in Lua 5.2Kim Alvefur2021-12-111-4/+4
| | | | Amazing how string.format behaves differently under each Lua version
* util.format: ALL THE TESTS!!!Kim Alvefur2021-12-111-0/+842
| | | | | | The more tests I made, the more Lua 5.1 quirks I discovered. Tests generated using a tool plus some touch-up.
* util.format: Also handle the %p format added in Lua 5.4Kim Alvefur2021-12-111-0/+9
|
* util.format: Ensure sanitation of strings passed to wrong formatKim Alvefur2021-12-111-0/+1
| | | | | | | | | Ie. log("debug", "%d", "\1\2\3") should not result in garbage. Also optimizing for the common case of ASCII string passed to %s and early returns everywhere. Returning nil from a gsub callback keeps the original substring.
* util.format: Escape invalid UTF-8 by passing trough serializationKim Alvefur2021-12-101-0/+4
| | | | | | Should prevent invalid UTF-8 from making it into the logs, which can cause trouble with terminals or log viewers or other tools, such as when grep determines that log files are binary.
* util.format: Change formatting of nil values to avoid looking like XMLKim Alvefur2021-06-291-4/+4
|
* util.format: Escape ASCII control characters in outputKim Alvefur2021-06-151-0/+5
| | | | | | | This should offer some protection against doing evil things to terminals. Doesn't protect against pure broken UTF-8 garbage however. See #734
* util.format: Handle integer formats the same way on Lua versions without ↵Kim Alvefur2019-05-301-0/+1
| | | | integer support
* util.format: Handle formats expecting an integer in Lua 5.3+ (fixes #1371)Kim Alvefur2019-05-301-0/+1
|
* util.format: Serialize values for the %q formatKim Alvefur2018-10-121-0/+1
| | | | Improves eg debug logs
* util.format: Tweak how nil values are handledKim Alvefur2018-11-281-0/+2
| | | | Because [<nil>] seems exsessive
* util.format: Add test coverage for case of extra nil argumentKim Alvefur2018-03-171-0/+1
|
* util.format: Fix tests to have expected value firstKim Alvefur2018-03-171-5/+5
|
* util.format: Move tests to spec/Kim Alvefur2017-11-101-0/+13