diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-22 11:04:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-22 11:04:26 -0300 |
commit | 73c6ff659332d599e3faf20d87f0c898a3522a18 (patch) | |
tree | ff67ca32d54fb9914e9ce0f2f35734f11d8932e1 | |
parent | 89aee84cbc9224f638f3b7951b306d2ee8ecb71e (diff) | |
download | lua-73c6ff659332d599e3faf20d87f0c898a3522a18.tar.gz lua-73c6ff659332d599e3faf20d87f0c898a3522a18.tar.bz2 lua-73c6ff659332d599e3faf20d87f0c898a3522a18.zip |
More generic pattern when testing 'string.format'
The result of 'string.format("%a", 0.0)' can have multiple zeros
after the dot.
-rw-r--r-- | testes/strings.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testes/strings.lua b/testes/strings.lua index c37a8e75..976bcdfb 100644 --- a/testes/strings.lua +++ b/testes/strings.lua | |||
@@ -269,8 +269,8 @@ do print("testing 'format %a %A'") | |||
269 | matchhexa(n) | 269 | matchhexa(n) |
270 | end | 270 | end |
271 | 271 | ||
272 | assert(string.find(string.format("%A", 0.0), "^0X0%.?0?P%+?0$")) | 272 | assert(string.find(string.format("%A", 0.0), "^0X0%.?0*P%+?0$")) |
273 | assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0?p%+?0$")) | 273 | assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0*p%+?0$")) |
274 | 274 | ||
275 | if not _port then -- test inf, -inf, NaN, and -0.0 | 275 | if not _port then -- test inf, -inf, NaN, and -0.0 |
276 | assert(string.find(string.format("%a", 1/0), "^inf")) | 276 | assert(string.find(string.format("%a", 1/0), "^inf")) |