test/unit/bio/test_feature.rb in bio-1.2.1 vs test/unit/bio/test_feature.rb in bio-1.3.0

- old
+ new

@@ -3,19 +3,20 @@ # # Copyright:: Copyright (C) 2005 # Mitsuteru Nakao <n@bioruby.org> # License:: The Ruby License # -# $Id: test_feature.rb,v 1.5 2007/04/05 23:35:42 trevor Exp $ +# $Id: test_feature.rb,v 1.5.2.1 2008/05/08 05:38:01 ngoto Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3 , 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/feature' +require 'bio/compat/features' module Bio class TestQualifier < Test::Unit::TestCase @@ -86,12 +87,39 @@ @obj.append(Bio::Feature::Qualifier.new("organism", "Arabidopsis thaliana")) assert_equal({"organism" => "Arabidopsis thaliana"}, @obj.assoc) end end + class NullStderr + def initialize + @log = [] + end + + def write(*arg) + #p arg + @log.push([ :write, *arg ]) + nil + end + + def method_missing(*arg) + #p arg + @log.push arg + nil + end + end + class TestFeatures < Test::Unit::TestCase def setup + # To suppress warning messages, $stderr is replaced by dummy object. + @stderr_orig = $stderr + $stderr = NullStderr.new + @obj = Bio::Features.new([Bio::Feature.new('gene', '1..615', [])]) + end + + def teardown + # bring back $stderr + $stderr = @stderr_orig end def test_features assert_equal(1, @obj.features.size) end