mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
parent
682c050f1e
commit
78607d2bbb
2 changed files with 17 additions and 2 deletions
|
@ -164,8 +164,8 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
|
|||
class Number < Value
|
||||
def expr
|
||||
jdsl.eValue(source_meta, text_value.include?(".") ?
|
||||
text_value.to_f :
|
||||
text_value.to_i)
|
||||
Float(text_value) :
|
||||
Integer(text_value))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -143,6 +143,21 @@ describe LogStashConfigParser do
|
|||
|
||||
expect(config).to be_nil
|
||||
end
|
||||
|
||||
it "supports octal literals" do
|
||||
parser = LogStashConfigParser.new
|
||||
config = parser.parse(%q(
|
||||
input {
|
||||
example {
|
||||
foo => 010
|
||||
}
|
||||
}
|
||||
))
|
||||
|
||||
compiled_number = eval(config.recursive_select(LogStash::Config::AST::Number).first.compile)
|
||||
|
||||
expect(compiled_number).to be == 8
|
||||
end
|
||||
end
|
||||
|
||||
context "when config.support_escapes" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue