Sha256: bb15b7886c6303c1bdd460e0e010d8aad450732afe2788e83a37aef1ae6eee8e
Contents?: true
Size: 858 Bytes
Versions: 2
Compression:
Stored size: 858 Bytes
Contents
#require 'rubygems' require 'Grok' require 'test/unit' class PathPatternsTest < Test::Unit::TestCase def setup @grok = Grok.new path = "#{File.dirname(__FILE__)}/../../../patterns/base" @grok.add_patterns_from_file(path) @grok.compile("%{PATH}") end def test_unix_paths paths = %w{/ /usr /usr/bin /usr/bin/foo /etc/motd /home/.test /foo/bar//baz //testing /.test /%foo% /asdf/asdf,v} paths.each do |path| match = @grok.match(path) assert_not_equal(false, match) assert_equal(path, match.captures["PATH"][0]) end end def test_windows_paths paths = %w{C:\WINDOWS \\Foo\bar} paths << "C:\\Documents and Settings\\" paths.each do |path| match = @grok.match(path) assert_not_equal(false, match) assert_equal(path, match.captures["PATH"][0]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jls-grok-0.1.2787 | test/patterns/path.rb |
jls-grok-0.1.2786 | test/patterns/path.rb |