-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_logger.rb
45 lines (34 loc) · 996 Bytes
/
test_logger.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###
# to run use
# ruby -I ./lib -I ./test test/test_logger.rb
# or better
# rake test
require 'helper'
class TestLogger < MiniTest::Test
include LogUtils # lets us use Logger instead of LogUtils::Logger
####
# just for testing testing machinery
# simple tests
def test_root
l1 = Logger[ self ]
l2 = Logger[ 'Test' ]
l3 = Logger[ TestLogger ]
### nb: for now all return LogUtils::Kernel::STDLOGGER
assert(l1 == LogKernel::STDLOGGER )
assert(l2 == LogKernel::STDLOGGER )
assert(l3 == LogKernel::STDLOGGER )
end
class SampleClass
include LogUtils # NB: constant from containing class not available (only if class is nested in module)
include Logging
end
class Sample2Class
include LogUtils::Logging
end
def test_class
obj = SampleClass.new
obj2 = Sample2Class.new
assert( obj.logger == LogKernel::STDLOGGER )
assert( obj2.logger == LogKernel::STDLOGGER )
end
end