aboutsummaryrefslogtreecommitdiff
path: root/testes/strings.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Avoid excessive name pollution in test filesRoberto Ierusalimschy2022-12-281-3/+3
| | | | | Test files are more polite regarding the use of globals when locals would do, and when globals are necessary deleting them after use.
* Portability issue in a test for 'string.format'Roberto Ierusalimschy2022-10-191-2/+7
|
* Revamp of format validation in 'string.format'Roberto Ierusalimschy2021-09-031-8/+28
| | | | | When calling 'sprintf', not all conversion specifiers accept all flags; some combinations are undefined behavior.
* Bug: 'string.concat' error message uses wrong formatRoberto Ierusalimschy2021-02-151-0/+3
|
* Simplification and smaller buffers for 'lua_pushfstring'Roberto Ierusalimschy2020-07-031-1/+1
| | | | | The function 'lua_pushfstring' is seldom called with large strings, there is no need to optimize too much for that cases.
* Fixed bug in 'string.format("%p")'Roberto Ierusalimschy2020-03-161-4/+14
| | | | | The string "(null)" used for non-collectable values must be printed as a string, not as a pointer. (Bug introduced in commit e0cbaa50fa7).
* Joined common code in 'lua_rawset' and 'lua_rawsetp'Roberto Ierusalimschy2019-12-171-2/+5
|
* More generic pattern when testing 'string.format'Roberto Ierusalimschy2019-11-221-2/+2
| | | | | The result of 'string.format("%a", 0.0)' can have multiple zeros after the dot.
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-3/+3
| | | | | | | | The macro 'luaL_pushfail' documents all places in the standard libraries that return nil to signal some kind of failure. It is defined as 'lua_pushnil'. The manual also got a notation (@fail) to document those returns. The tests were changed to be agnostic regarding whether 'fail' is 'nil' or 'false'.
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-301-2/+2
| | | | | | | Attributes changed to posfixed ('x <const>', instead of '<const> x'), and "toclose" renamed to "close". Posfixed attributes seem to make it clearer that it applies to only one variable when there are multiple variables.
* Change in the handling of 'L->top' when calling metamethodsRoberto Ierusalimschy2019-07-261-2/+5
| | | | | | | Instead of updating 'L->top' in every place that may call a metamethod, the metamethod functions themselves (luaT_trybinTM and luaT_callorderTM) correct the top. (When calling metamethods from the C API, however, the callers must preserve 'L->top'.)
* Fixed bug in 'string.format' with option '%f'Roberto Ierusalimschy2019-07-231-0/+6
| | | | | | | | | | | As an example, 'print(string.format("%.99f", 1e70))' may have a lot of garbage after the number. The old test to ensure that 'string.format("%.99f", n)' was not too large, 'fabs(n) < 1e100', assumes that the number will fit in the 99 bytes; but the 99 is not the space for the number, it is the added extra zeros. The option worked for smaller numbers because of the extra space added to MAX_ITEM.
* Reviving HARDMEMTESTSRoberto Ierusalimschy2019-07-181-3/+8
| | | | | | | | | | | This commit brings a new implementation for HARDMEMTESTS, which forces an emergency GC whenever possible. It also fixes some issues detected with this option: - A small bug in lvm.c: a closure could be collected by an emergency GC while being initialized. - Some tests: a memory address can be immediatly reused after a GC; for instance, two consecutive '{}' expressions can return exactly the same address, if the first one is not anchored.
* DetailsRoberto Ierusalimschy2019-05-281-1/+2
| | | | | | | - new error message for "attempt to assign to const variable" - note in the manual about compatibility options - comments - small changes in 'read_line' and 'pushstr'
* A few more improvements in 'luaO_pushvfstring'Roberto Ierusalimschy2019-05-031-2/+1
| | | | | | | | - 'L' added to the 'BuffFS' structure - '%c' does not handle control characters (it is not its business. This now is done by the lexer, who is the one in charge of that kind of errors.) - avoid the direct use of 'l_sprintf' in the Lua kernel
* Some more small improvements to 'luaO_pushvfstring'Roberto Ierusalimschy2019-04-261-0/+3
| | | | | | | Details: - counter 'pushed' moved to the struct 'BuffFS' - new auxiliar function 'getbuff' to build strings directly on the buffer.
* Revamp of 'lua_pushfstring' / 'luaO_pushvfstring'Roberto Ierusalimschy2019-04-241-0/+61
| | | | | | | | | The function 'luaO_pushvfstring' now uses an internal buffer to concatenate small strings, instead of pushing all pieces on the stack. This avoids the creation of several small Lua strings for each piece of the result. (For instance, a format like "n: '%d'" used to create three intermediate strings: "n: '", the numeral, and "'". Now it creates none.)
* New conversion specifier '%p' for 'string.format'Roberto Ierusalimschy2019-03-131-0/+16
| | | | | The call 'string.format("%p", val)' gives a Lua equivalent to the C API function 'lua_topointer'.
* DetailsRoberto Ierusalimschy2019-03-131-0/+1
| | | | | | | | | | Several small improvements (code style, warnings, comments, more tests), in particular: - 'lua_topointer' extended to handle strings - raises an error in 'string.format("%10q")' ('%q' with modifiers) - in the manual for 'string.format', the term "option" replaced by "conversion specifier" (the term used by the C standard)
* Optional 'init' argument to 'string.gmatch'Roberto Ierusalimschy2019-01-081-0/+5
| | | | | | | | | The function 'string.gmatch' now has an optional 'init' argument, similar to 'string.find' and 'string.match'. Moreover, there was some reorganization in the manipulation of indices in the string library. This commit also includes small janitorial work in the manual and in comments in the interpreter loop.
* DetailRoberto Ierusalimschy2018-12-271-1/+1
| | | | Slightly better error message for invalid conversions in 'string.format'.
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | From the point of view of 'git', all names are relative to the root directory of the project. So, file names in '$Id:' also should be relative to that directory: the proper name for test file 'all.lua' is 'testes/all.lua'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+382