summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-22 11:07:47 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-22 11:07:47 -0300
commit6f1c033d72af8fe65bb67e17a242314b6aeb182f (patch)
treece810a8572569df64a3c7de5158ffce48d4634dd
parent5f83fb658206d195e54d3574b989ce5285a5b18f (diff)
downloadlua-6f1c033d72af8fe65bb67e17a242314b6aeb182f.tar.gz
lua-6f1c033d72af8fe65bb67e17a242314b6aeb182f.tar.bz2
lua-6f1c033d72af8fe65bb67e17a242314b6aeb182f.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.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/testes/strings.lua b/testes/strings.lua
index 97875ec0..f2f61413 100644
--- a/testes/strings.lua
+++ b/testes/strings.lua
@@ -309,8 +309,8 @@ do print("testing 'format %a %A'")
309 matchhexa(n) 309 matchhexa(n)
310 end 310 end
311 311
312 assert(string.find(string.format("%A", 0.0), "^0X0%.?0?P%+?0$")) 312 assert(string.find(string.format("%A", 0.0), "^0X0%.?0*P%+?0$"))
313 assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0?p%+?0$")) 313 assert(string.find(string.format("%a", -0.0), "^%-0x0%.?0*p%+?0$"))
314 314
315 if not _port then -- test inf, -inf, NaN, and -0.0 315 if not _port then -- test inf, -inf, NaN, and -0.0
316 assert(string.find(string.format("%a", 1/0), "^inf")) 316 assert(string.find(string.format("%a", 1/0), "^inf"))