# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/more/annotation.rb # # Extracted Tue Jun 20 15:12:27 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/more/annotation.rb' require 'test/unit' class TC01 < Test::Unit::TestCase class X def x1 ; end ann :x1, :q=>3 ann :x1, :a=>1 end def test_01_001 assert_equal( 1, X.ann(:x1)[:a] ) assert_equal( 3, X.ann(:x1)[:q] ) assert_equal( null, X.ann(:x2) ) end def test_01_002 assert_equal( 1, X.ann(:x1)[:a] ) assert_equal( 3, X.ann(:x1)[:q] ) assert_equal( nil, X.ann(:x1)[:c] ) end def test_01_003 assert_equal( 1, X.ann.x1[:a] ) assert_equal( 3, X.ann.x1[:q] ) end def test_01_004 assert_equal( 1, X.ann.x1.a ) assert_equal( 3, X.ann.x1.q ) end def test_01_005 assert_equal( null, X.ann.x2 ) assert_equal( null, X.ann.x1.r ) end def test_02_007 X.ann.x1.a = 2 assert_equal(2, X.ann.x1.a) end end class TC02 < Test::Unit::TestCase class X def x ; end ann :x, :z=>1 end class Y < X #ann :x, :y=>2 end def test_02_001 assert( Y.annotated?( :x ) ) end def test_02_002 #assert_equal( [:x1], Y.annotated_methods ) end def test_02_003 #assert_equal( 1, Y.ann(:x).inheritance ) #assert_equal( 1, Y.ann(:x) ) end def test_02_004 assert_equal(1, X.ann(:x)[:z]) assert_equal(1, Y.ann(:x)[:z]) end def test_02_005 assert_equal(1, Y.ann(:x).z) end def test_02_006 assert_equal(1, Y.ann.x.z) end def test_02_007 Y.ann.x.z = 2 assert_equal(2, Y.ann.x.z) end end class TC03 < Test::Unit::TestCase class X def n ; end ann :n, :v=>1 ann :n, :p=>3 end class Y < X ann :n, :b=>2 end def test_03_001 assert_equal(2, Y.ann(:n)[:b]) assert_equal(1, Y.ann(:n)[:v]) end def test_03_002 assert_equal(2, Y.ann(:n).b) end def test_03_003 assert_equal(2, Y.ann.n.b) end def test_03_004 #assert_equal( [:n], Y.annotated_methods ) end end class TC04 < Test::Unit::TestCase module M ann :m, :c=>3 end def test_04_001 assert_equal(3, M.ann.m.c) end end class TC05 < Test::Unit::TestCase module M ann :m, :c=>3 end class Y ; end class Z < Y include M end def test_05_001 assert_equal( 3, Z.ann.m.c ) end end class TC06 < Test::Unit::TestCase module M ann :m, String end def test_06_001 assert_equal( String, M.ann.m.class ) end end class TC07 < Test::Unit::TestCase class K ann self, :oid => 'key' ann :w, String end def test_07_001 assert_equal( String, K.ann.w.class ) end def test_07_002 assert_equal( 'key', K.ann.self.oid ) end def test_07_003 #assert_equal( K.ann.self, K.ann(:self) ) #assert_equal( K.ann(K), K.annotation ) #assert_equal( K.ann.self.to_h, K.ann(K).to_h ) #assert_equal( K.ann.self, K.ann(K) ) end end class TC08 < Test::Unit::TestCase module M ann :this, :koko => [] ann.this.koko! << 1 end class C1 #ann :this, :koko => [] include M ann.this.koko! << 2 ann.this.koko! << 3 end class C2 include M ann.this.koko! << 4 end def test_08_001 assert_equal( [1], M.ann.this.koko ) end def test_08_002 assert_equal( [1,2,3], C1.ann.this.koko ) end def test_08_003 assert_equal( [1,4], C2.ann.this.koko ) end end