Sha256: 0968523c58d9c2a075ef548b0f15043f38deaa01f1924ae96871f7ffc6df7221

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

require 'helper'
require 'rouge/lexers/fluentd'

class TestRougeLexersFluentd < Test::Unit::TestCase
  def setup
    @lexer = Rouge::Lexers::Fluentd.new(debug: ENV['ROUGE_DEBUG'])
    @demo = File.read(File.join(__dir__, '../lib/rouge/demos/fluentd'))
    @demo_stack = YAML.load(File.read(File.join(__dir__, 'demo-stack.yaml')))
  end

  data("fluent.conf", "fluent.conf")
  data("td-agent.conf", "td-agent.conf")
  def test_guess(filename)
    actual = Rouge::Lexer.guess(filename: filename)
    assert_equal Rouge::Lexers::Fluentd, actual
  end

  def test_lex
    tokens = @lexer.lex(@demo)
    stack = tokens.collect {|token, value|
      [token.qualname, value]
    }
    assert_equal @demo_stack, stack
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rouge-lexers-fluentd-0.1.1 test/test_rouge-lexers-fluentd.rb
rouge-lexers-fluentd-0.1.0 test/test_rouge-lexers-fluentd.rb