diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-07 11:17:30 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-07 11:17:30 -0300 |
| commit | e2ea3b31c94bb3e1da27c233661cb2a16699c685 (patch) | |
| tree | 1d817c8d90e5fbd2c52dff18383a085f2bc847c1 | |
| parent | 23051e830a8b212f831443eb888e93e30fa8bb19 (diff) | |
| download | lua-e2ea3b31c94bb3e1da27c233661cb2a16699c685.tar.gz lua-e2ea3b31c94bb3e1da27c233661cb2a16699c685.tar.bz2 lua-e2ea3b31c94bb3e1da27c233661cb2a16699c685.zip | |
Details (do not affect regular code)
* Avoids multiple definitions of 'lua_assert' in test file.
* Smaller C-stack limit in test mode.
* Note in the manual about the use of false
* Extra test for constant reuse.
| -rw-r--r-- | lauxlib.h | 10 | ||||
| -rw-r--r-- | ltests.h | 5 | ||||
| -rw-r--r-- | manual/manual.of | 5 | ||||
| -rw-r--r-- | testes/code.lua | 14 |
4 files changed, 31 insertions, 3 deletions
| @@ -160,11 +160,15 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, | |||
| 160 | /* | 160 | /* |
| 161 | ** Internal assertions for in-house debugging | 161 | ** Internal assertions for in-house debugging |
| 162 | */ | 162 | */ |
| 163 | #if !defined(lua_assert) | ||
| 164 | |||
| 163 | #if defined LUAI_ASSERT | 165 | #if defined LUAI_ASSERT |
| 164 | #include <assert.h> | 166 | #include <assert.h> |
| 165 | #define lua_assert(c) assert(c) | 167 | #define lua_assert(c) assert(c) |
| 166 | #else | 168 | #else |
| 167 | #define lua_assert(x) ((void)0) | 169 | #define lua_assert(c) ((void)0) |
| 170 | #endif | ||
| 171 | |||
| 168 | #endif | 172 | #endif |
| 169 | 173 | ||
| 170 | 174 | ||
| @@ -130,6 +130,11 @@ LUA_API void *debug_realloc (void *ud, void *block, | |||
| 130 | #define LUAI_MAXSTACK 50000 | 130 | #define LUAI_MAXSTACK 50000 |
| 131 | 131 | ||
| 132 | 132 | ||
| 133 | /* test mode uses more stack space */ | ||
| 134 | #undef LUAI_MAXCCALLS | ||
| 135 | #define LUAI_MAXCCALLS 180 | ||
| 136 | |||
| 137 | |||
| 133 | /* force Lua to use its own implementations */ | 138 | /* force Lua to use its own implementations */ |
| 134 | #undef lua_strx2number | 139 | #undef lua_strx2number |
| 135 | #undef lua_number2strx | 140 | #undef lua_number2strx |
diff --git a/manual/manual.of b/manual/manual.of index 606771f4..771bace0 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
| @@ -88,6 +88,11 @@ The type @emph{boolean} has two values, @false and @true. | |||
| 88 | Both @nil and @false make a condition false; | 88 | Both @nil and @false make a condition false; |
| 89 | they are collectively called @def{false values}. | 89 | they are collectively called @def{false values}. |
| 90 | Any other value makes a condition true. | 90 | Any other value makes a condition true. |
| 91 | Despite its name, | ||
| 92 | @false is frequently used as an alternative to @nil, | ||
| 93 | with the key difference that @false behaves | ||
| 94 | like a regular value in a table, | ||
| 95 | while a @nil in a table represents an absent key. | ||
| 91 | 96 | ||
| 92 | The type @emph{number} represents both | 97 | The type @emph{number} represents both |
| 93 | integer numbers and real (floating-point) numbers, | 98 | integer numbers and real (floating-point) numbers, |
diff --git a/testes/code.lua b/testes/code.lua index 1f971cd7..4e00309f 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
| @@ -55,6 +55,20 @@ end | |||
| 55 | checkKlist(foo, {3.78/4, -3.78/4, -3.79/4}) | 55 | checkKlist(foo, {3.78/4, -3.78/4, -3.79/4}) |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | foo = function (f, a) | ||
| 59 | f(100 * 1000) | ||
| 60 | f(100.0 * 1000) | ||
| 61 | f(-100 * 1000) | ||
| 62 | f(-100 * 1000.0) | ||
| 63 | f(100000) | ||
| 64 | f(100000.0) | ||
| 65 | f(-100000) | ||
| 66 | f(-100000.0) | ||
| 67 | end | ||
| 68 | |||
| 69 | checkKlist(foo, {100000, 100000.0, -100000, -100000.0}) | ||
| 70 | |||
| 71 | |||
| 58 | -- testing opcodes | 72 | -- testing opcodes |
| 59 | 73 | ||
| 60 | -- check that 'f' opcodes match '...' | 74 | -- check that 'f' opcodes match '...' |
