1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-19 19:55:30 +08:00

Fix for S15.1.2.3_A2_T10

This commit is contained in:
Robert Krimen 2017-01-12 16:21:41 -08:00
parent e314343b47
commit 87e059e861
2 changed files with 16 additions and 1 deletions

View File

@ -675,3 +675,17 @@ func Test_S15_1_2_2_A2_T10(t *testing.T) {
`, true) `, true)
}) })
} }
func Test_S15_1_2_3_A2_T10(t *testing.T) {
tt(t, func() {
test, _ := test()
test(`
parseFloat("\u180E" + "1.1") === parseFloat("1.1");
`, true)
test(`
parseFloat("\u180E" + "\u180E" + "\u180E" + "1.1") === parseFloat("1.1");
`, true)
})
}

View File

@ -153,7 +153,8 @@ var parseFloat_matchValid = regexp.MustCompile(`[0-9eE\+\-\.]|Infinity`)
func builtinGlobal_parseFloat(call FunctionCall) Value { func builtinGlobal_parseFloat(call FunctionCall) Value {
// Caveat emptor: This implementation does NOT match the specification // Caveat emptor: This implementation does NOT match the specification
input := strings.TrimSpace(call.Argument(0).string()) input := strings.Trim(call.Argument(0).string(), builtinString_trim_whitespace)
if parseFloat_matchBadSpecial.MatchString(input) { if parseFloat_matchBadSpecial.MatchString(input) {
return NaNValue() return NaNValue()
} }