Revert "Return XPath integers as actual integers."

The particular case of string(10) having to return "10" instead of "10.0" will
be handled separately. Returning integers breaks behaviour/expectations
elsewhere.

This reverts commit 431a253000.
This commit is contained in:
Yorick Peterse 2014-08-25 23:14:22 +02:00
parent a1a2190fe2
commit 6c0c5ab720
3 changed files with 4 additions and 4 deletions

View File

@ -967,7 +967,7 @@ module Oga
# @return [Float]
#
def on_int(ast_node, context)
return ast_node.children[0]
return ast_node.children[0].to_f
end
##

View File

@ -37,7 +37,7 @@ describe Oga::XPath::Evaluator do
end
example 'convert an integer to a string' do
@evaluator.evaluate('string(10)').should == '10'
@evaluator.evaluate('string(10)').should == '10.0'
end
example 'convert a float to a string' do

View File

@ -12,8 +12,8 @@ describe Oga::XPath::Evaluator do
@number.should == 1
end
example 'return integers as Fixnums' do
@number.is_a?(Fixnum).should == true
example 'return integers as floats' do
@number.is_a?(Float).should == true
end
end
end