mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-18 18:38:18 +00:00
6adb43221f
Extracts the wrap function to its own little crate and expose that to lua.
18 lines
595 B
Lua
18 lines
595 B
Lua
local kumo = require 'kumo'
|
|
local utils = require 'policy-extras.policy_utils'
|
|
|
|
utils.assert_eq(kumo.string.wrap 'hello', 'hello')
|
|
|
|
local long_string = string.rep('A', 200)
|
|
local expect_wrapped = string.rep('A', 100)
|
|
.. '\r\n\t'
|
|
.. string.rep('A', 100)
|
|
utils.assert_eq(kumo.string.wrap(long_string, 75, 100), expect_wrapped)
|
|
|
|
local long_string_spaced = string.rep(' hello there', 10)
|
|
utils.assert_eq(
|
|
kumo.string.wrap(long_string_spaced, 75, 100),
|
|
'hello there hello there hello there hello there hello there hello there\r\n'
|
|
.. '\thello there hello there hello there hello there'
|
|
)
|