From c23403f232c7fd7e9d5959be51401cd32c5bd1ce Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Thu, 19 Jul 2012 13:46:22 -0700 Subject: [PATCH] - Add test to cover pull #175 / LOGSTASH-528 --- test/logstash/test_event.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/logstash/test_event.rb b/test/logstash/test_event.rb index de7e05846dd..d98c9937230 100644 --- a/test/logstash/test_event.rb +++ b/test/logstash/test_event.rb @@ -21,7 +21,12 @@ test "sprintf should join array fields by comma" do @event.fields["foo"] = ["one", "two", "three"] 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 assert_equal("%{foo}", @event.sprintf("%{foo}"))