Sha256: 0360041270cc1f440c3822de4526b132795a833612a522c32180fded28dbbfa6

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.

$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'

module QuickML
  class MockLogger
    def initialize
      clear
    end

    def clear
      @log = []
      @vlog = []
    end

    def log(str)
      @vlog << str
      @log << str
    end

    def vlog(str)
      @vlog << str
    end

    def get_log
      lo = @log
      clear
      return lo
    end

    def get_vlog
      lo = @vlog
      clear
      return lo
    end
  end
end

if $0 == __FILE__
  require 'qwik/testunit'
  $test = true
end

if defined?($test) && $test
  class TestMockLogger < Test::Unit::TestCase
    def test_all
      # test_initialize
      s = QuickML::MockLogger.new

      # test_log
      s.log('t')

      # test_get_log
      ok_eq(['t'], s.get_log)

      # test_vlog
      s.vlog('v')

      # test_get_vlog
      ok_eq(['v'], s.get_vlog)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
qwik2md-2.0.1 vendor/qwik/lib/qwik/mock-logger.rb
qwik2md-2.0.0 vendor/qwik/lib/qwik/mock-logger.rb
qwik2md-1.0.2 vendor/qwik/lib/qwik/mock-logger.rb
qwik2md-1.0.1 vendor/qwik/lib/qwik/mock-logger.rb
qwik2md-1.0.0 vendor/qwik/lib/qwik/mock-logger.rb
qwik2md-0.1.0 vendor/qwik/lib/qwik/mock-logger.rb
qwikdoc-0.0.1 vendor/qwik/mock-logger.rb