Merge branch 'devel' into araq

This commit is contained in:
Andreas Rumpf 2017-03-30 23:56:22 +02:00
commit 0ccbc82344
5 changed files with 318 additions and 269 deletions

View file

@ -0,0 +1,29 @@
discard """
output: '''Check passed
Check passed'''
"""
# bug #5628
proc checkException(ex: ref Exception) =
doAssert(ex.name == "ValueError")
doAssert(ex.msg == "SecondException")
doAssert(ex.parent != nil)
doAssert(ex.parent.name == "KeyError")
doAssert(ex.parent.msg == "FirstException")
echo "Check passed"
var e: ref Exception
try:
try:
raise newException(KeyError, "FirstException")
except:
raise newException(ValueError, "SecondException", getCurrentException())
except:
e = getCurrentException()
try:
checkException(e) # passes here
raise e
except ValueError:
checkException(getCurrentException()) # fails here

26
tests/js/ttimes.nim Normal file
View file

@ -0,0 +1,26 @@
# test times module with js
discard """
action: run
"""
import times
# $ date --date='@2147483647'
# Tue 19 Jan 03:14:07 GMT 2038
block yeardayTest:
# check if yearday attribute is properly set on TimeInfo creation
doAssert fromSeconds(2147483647).getGMTime().yearday == 18
block localTimezoneTest:
# check if timezone is properly set during Time to TimeInfo conversion
doAssert fromSeconds(2147483647).getLocalTime().timezone == getTimezone()
block timestampPersistenceTest:
# check if timestamp persists during TimeInfo to Time conversion
const
timeString = "2017-03-21T12:34:56+03:00"
timeStringGmt = "2017-03-21T09:34:56+00:00"
fmt = "yyyy-MM-dd'T'HH:mm:sszzz"
doAssert $timeString.parse(fmt).toTime().getGMTime() == timeStringGmt