mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Add test to cover negative array offsets in field references. It currently fails.
Fixes #6226
This commit is contained in:
parent
ac66402f12
commit
c720d26bcf
1 changed files with 10 additions and 0 deletions
|
@ -61,6 +61,16 @@ describe LogStash::Event do
|
|||
expect(e.get("[foo][2]")).to eq(1.0)
|
||||
expect(e.get("[foo][3]")).to be_nil
|
||||
end
|
||||
|
||||
context "negative array values" do
|
||||
it "should index from the end of the array" do
|
||||
list = ["bar", 1, 1.0]
|
||||
e = LogStash::Event.new({"foo" => list})
|
||||
expect(e.get("[foo][-3]")).to eq(list[-3])
|
||||
expect(e.get("[foo][-2]")).to eq(list[-2])
|
||||
expect(e.get("[foo][-1]")).to eq(list[-1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "#set" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue