Skip to content

Commit fb3dd2b

Browse files
committed
tests/lapi: fix string_rep_test
The patch fixes description (synopsis is at the end of the description) and fixes lower boundary for `n`, with `n` equal to zero assertion calculates negative number in right part of expression.
1 parent 5daf32d commit fb3dd2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/lapi/string_rep_test.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Copyright (c) 2023-2025, Sergey Bronnikov.
55
6.4 – String Manipulation
66
https://www.lua.org/manual/5.3/manual.html#6.4
77
8-
Synopsis: string.rep(s, n [, sep])
9-
108
read overflow in 'l_strcmp',
119
https://github.com/lua/lua/commit/f623b969325be736297bc1dff48e763c08778243
10+
11+
Synopsis: string.rep(s, n [, sep])
1212
]]
1313

1414
local luzer = require("luzer")
@@ -18,7 +18,7 @@ local function TestOneInput(buf, _size)
1818
local fdp = luzer.FuzzedDataProvider(buf)
1919
os.setlocale(test_lib.random_locale(fdp), "all")
2020
-- Huge length leads to slow units.
21-
local n = fdp:consume_integer(0, test_lib.MAX_STR_LEN)
21+
local n = fdp:consume_integer(1, test_lib.MAX_STR_LEN)
2222
local s = fdp:consume_string(test_lib.MAX_STR_LEN)
2323
local sep = fdp:consume_string(test_lib.MAX_STR_LEN)
2424
local len = string.len(string.rep(s, n, sep))

0 commit comments

Comments
 (0)