aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-09 18:44:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-09 18:44:13 -0300
commit0f028b9008097f00aa3953a3425c72e7ae2b4c98 (patch)
treec8d436c245b8e746daa1108ee93a9c991faa0b7d
parent65d1aa7a779b30bf5b0e7b968b3980b702b08b2c (diff)
downloadlua-0f028b9008097f00aa3953a3425c72e7ae2b4c98.tar.gz
lua-0f028b9008097f00aa3953a3425c72e7ae2b4c98.tar.bz2
lua-0f028b9008097f00aa3953a3425c72e7ae2b4c98.zip
Corrected tests around non-portable 'isdst' in dates
The field 'isdst' in date tables may not be present; portable tests should not assume it is.
-rw-r--r--testes/files.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/testes/files.lua b/testes/files.lua
index 34fcf851..0a05cf60 100644
--- a/testes/files.lua
+++ b/testes/files.lua
@@ -777,7 +777,7 @@ local t = os.time()
777D = os.date("*t", t) 777D = os.date("*t", t)
778load(os.date([[assert(D.year==%Y and D.month==%m and D.day==%d and 778load(os.date([[assert(D.year==%Y and D.month==%m and D.day==%d and
779 D.hour==%H and D.min==%M and D.sec==%S and 779 D.hour==%H and D.min==%M and D.sec==%S and
780 D.wday==%w+1 and D.yday==%j and type(D.isdst) == 'boolean')]], t))() 780 D.wday==%w+1 and D.yday==%j)]], t))()
781 781
782checkerr("invalid conversion specifier", os.date, "%") 782checkerr("invalid conversion specifier", os.date, "%")
783checkerr("invalid conversion specifier", os.date, "%9") 783checkerr("invalid conversion specifier", os.date, "%9")
@@ -827,12 +827,16 @@ end
827D = os.date("!*t", t) 827D = os.date("!*t", t)
828load(os.date([[!assert(D.year==%Y and D.month==%m and D.day==%d and 828load(os.date([[!assert(D.year==%Y and D.month==%m and D.day==%d and
829 D.hour==%H and D.min==%M and D.sec==%S and 829 D.hour==%H and D.min==%M and D.sec==%S and
830 D.wday==%w+1 and D.yday==%j and type(D.isdst) == 'boolean')]], t))() 830 D.wday==%w+1 and D.yday==%j)]], t))()
831 831
832do 832do
833 local D = os.date("*t") 833 local D = os.date("*t")
834 local t = os.time(D) 834 local t = os.time(D)
835 assert(type(D.isdst) == 'boolean') 835 if not D.isdst then
836 print("no daylight saving information")
837 else
838 assert(type(D.isdst) == 'boolean')
839 end
836 D.isdst = nil 840 D.isdst = nil
837 local t1 = os.time(D) 841 local t1 = os.time(D)
838 assert(t == t1) -- if isdst is absent uses correct default 842 assert(t == t1) -- if isdst is absent uses correct default