Skip to content

Commit

Permalink
Remove scientific computation from okjson
Browse files Browse the repository at this point in the history
Conflicts:
	spec/raven/okjson_spec.rb
  • Loading branch information
dcramer authored and nateberkopec committed Dec 8, 2014
1 parent f4e269c commit 477ee93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/raven/okjson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ def numtok(s)
elsif m[2]
[:val, m[0], Float(m[0])]
else
[:val, m[0], Integer(m[1])*(10**m[3][1..-1].to_i(10))]
# We don't convert scientific notation
[:val, m[0], m[0]]
end
else
[]
Expand Down Expand Up @@ -609,4 +610,4 @@ class Error < ::StandardError
Spc = ' '[0]
Unesc = {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}
end
end
end
4 changes: 2 additions & 2 deletions spec/raven/okjson_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
end
end

it 'parses zero-leading exponent numbers correctly' do
expect(Raven::OkJson.decode("[123e090]")).to eq [123000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
it 'does not parse scientific notation' do
expect(Raven::OkJson.decode("[123e090]")).to eq ["123e090"]
end

it 'it raises the correct error on strings that look like incomplete objects' do
Expand Down

0 comments on commit 477ee93

Please sign in to comment.