Sha256: 0412748a7d5c2d11af6fdbb231b0325f58fe604c362bb57447363b329a1dbc70
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
require 'test/unit' require 'fluent/plugin/filter_rename_key' class TestClass include Fluent::Plugin::RenameKeyUtil end class RenameKeyUtilTest < Test::Unit::TestCase def test_parse_rename_rule parsed = TestClass.new.send :parse_rename_rule, '(reg)(exp) ${md[1]} ${md[2]}' assert_equal 2, parsed.length assert_equal /(reg)(exp)/, parsed[:key_regexp] assert_equal '${md[1]} ${md[2]}', parsed[:new_key] end def test_parse_replace_rule_with_replacement # Replace hyphens with underscores parsed = TestClass.new.send :parse_replace_rule, '- _' assert_equal 2, parsed.length assert_equal /-/, parsed[:key_regexp] assert_equal '_', parsed[:replacement] end def test_parse_replace_rule_without_replacement # Remove all parentheses, hyphens, and spaces parsed = TestClass.new.send :parse_replace_rule, '[-\s()]' assert_equal 2, parsed.length assert_equal /[-\s()]/, parsed[:key_regexp] assert_equal '', parsed[:replacement] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-rename-key-0.4.1 | test/plugin/test_rename_key_util.rb |
fluent-plugin-rename-key-0.4.0 | test/plugin/test_rename_key_util.rb |