diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-22 11:07:47 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-11-22 11:07:47 -0300 |
| commit | 6f1c033d72af8fe65bb67e17a242314b6aeb182f (patch) | |
| tree | ce810a8572569df64a3c7de5158ffce48d4634dd | |
| parent | 5f83fb658206d195e54d3574b989ce5285a5b18f (diff) | |
| download | lua-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.lua | 4 |
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")) |
