mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
- Add test to cover pull #175 / LOGSTASH-528
This commit is contained in:
parent
4957f8bab2
commit
c23403f232
1 changed files with 6 additions and 1 deletions
|
@ -21,7 +21,12 @@ describe LogStash::Event do
|
||||||
test "sprintf should join array fields by comma" do
|
test "sprintf should join array fields by comma" do
|
||||||
@event.fields["foo"] = ["one", "two", "three"]
|
@event.fields["foo"] = ["one", "two", "three"]
|
||||||
assert_equal(@event.fields["foo"].join(","), @event.sprintf("%{foo}"))
|
assert_equal(@event.fields["foo"].join(","), @event.sprintf("%{foo}"))
|
||||||
end # sprintf testing
|
end # sprintf array testing
|
||||||
|
|
||||||
|
test "sprintf should represent hash fields as json" do
|
||||||
|
@event.fields["foo"] = { "hello" => "world", "foo" => 123 }
|
||||||
|
assert_equal(@event.fields["foo"].to_json, @event.sprintf("%{foo}"))
|
||||||
|
end # sprintf hash formatting
|
||||||
|
|
||||||
test "sprintf should not error when a token does not exist" do
|
test "sprintf should not error when a token does not exist" do
|
||||||
assert_equal("%{foo}", @event.sprintf("%{foo}"))
|
assert_equal("%{foo}", @event.sprintf("%{foo}"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue