Sha256: d2d08307df4cd6233c168235c2a67faab1543fe2ac50fd59d425df8e4b5d9394

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

#require 'rubygems'
require 'Grok'
require 'test/unit'

class MonthPatternsTest < Test::Unit::TestCase
  def setup
    @grok = Grok.new
    path = "#{File.dirname(__FILE__)}/../../../patterns/base"
    @grok.add_patterns_from_file(path)
    @grok.compile("%{MONTH}")
  end

  def test_urls
    months = ["Jan", "January", "Feb", "February", "Mar", "March", "Apr",
              "April", "May", "Jun", "June", "Jul", "July", "Aug", "August",
              "Sep", "September", "Oct", "October", "Nov", "November", "Dec",
              "December"]
    months.each do |month|
      match = @grok.match(month)
      assert_not_equal(false, match)
      assert_equal(month, match.captures["MONTH"][0])
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jls-grok-0.1.2787 test/patterns/month.rb
jls-grok-0.1.2786 test/patterns/month.rb