More spec-compliance issues

André Bargull andrebargull at googlemail.com
Mon Apr 15 10:14:37 PDT 2013


Again some more tests with broken spec-compliance.

- André



"abc".lastIndexOf("a",-1)
=> should return 0 instead of -1

Nashorn shell does not start with Turkish locale
=> locale dependent toLowerCase() in OptionTemplate needs to be changed 
to be locale independent

"i".toUpperCase()
=> currently returns "İ", but should be "I" (with Turkish locale)

RegExp("[")
=> StackOverflow exception

Array.prototype.reduceRight.call({length:0xffffffff, 0xfffffffe: "index: 
"}, function(acc,v,i,o){print(v+i); throw "stop"}, 0)
=> should print "index: 4294967294" and then throw the exception "stop"

Function().apply(null, Object.defineProperty([],"0",{get: 
function(){print("getter"); return 0}}))
=> should print "getter"

Function().apply(null, {length: null})
Function().apply(null, {length: 0.1})
=> should not throw an exception

Date.parse("2012-01-10T00:00:00.000-")
Date.parse("2012-01-01T00:00+")
=> should return NaN

new Date(NaN).setFullYear(NaN)
=> currently throws java.lang.NullPointerException

new Date(0).setYear(70)
=> should return 0

new Date(0).setYear(NaN)
=> should return NaN

new Date(NaN).setYear(70)
=> should return the new time value

new Date(NaN).getTimezoneOffset()
=> should return NaN

Date.prototype.setTime.call({},{valueOf:function(){throw "err"}})
=> should throw a TypeError instead of "err"

new Date(NaN).setMilliseconds({valueOf:function(){throw "err"}})
=> should throw "err"

Same bug with the following functions:
Date.prototype.setUTCMilliseconds
Date.prototype.setSeconds
Date.prototype.setUTCSeconds
Date.prototype.setMinutes
Date.prototype.setUTCMinutes
Date.prototype.setHours
Date.prototype.setUTCHours
Date.prototype.setDate
Date.prototype.setUTCDate
Date.prototype.setMonth
Date.prototype.setUTCMonth

Date.prototype.toJSON.call({valueOf:function(){return "foo"}, 
toISOString: function(){return "from-toISOString"}})
=> should return "from-toISOString"


More information about the nashorn-dev mailing list