ruby-changes:40675
From: hsbt <ko1@a...>
Date: Thu, 26 Nov 2015 09:51:12 +0900 (JST)
Subject: [ruby-changes:40675] hsbt:r52754 (trunk): * test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
hsbt 2015-11-26 09:51:03 +0900 (Thu, 26 Nov 2015) New Revision: 52754 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52754 Log: * test/coverage/test_coverage.rb: Added test-case for Coverage.restart. [Misc #11732][ruby-dev:49379] Modified files: trunk/ChangeLog trunk/test/coverage/test_coverage.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52753) +++ ChangeLog (revision 52754) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Nov 26 09:50:02 2015 yui-knk <spiketeika@g...> + + * test/coverage/test_coverage.rb: Added test-case for Coverage.restart. + [Misc #11732][ruby-dev:49379] + Thu Nov 26 09:46:36 2015 yui-knk <spiketeika@g...> * test/coverage/test_coverage.rb: Added test-case for Coverage.peek_result Index: test/coverage/test_coverage.rb =================================================================== --- test/coverage/test_coverage.rb (revision 52753) +++ test/coverage/test_coverage.rb (revision 52754) @@ -60,12 +60,30 @@ class TestCoverage < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/coverage/test_coverage.rb#L60 EOS end + File.open("test2.rb", "w") do |f| + f.puts <<-EOS + def coverage_test_method2 + :ok + :ok + end + EOS + end + Coverage.start require tmp + '/test.rb' assert_equal 3, Coverage.result[tmp + '/test.rb'].size + + # Restart coverage but '/test.rb' is required before restart, + # so coverage is not recorded. Coverage.start coverage_test_method assert_equal 0, Coverage.result[tmp + '/test.rb'].size + + # Restart coverage and '/test2.rb' is required after restart, + # so coverage is recorded. + Coverage.start + require tmp + '/test2.rb' + assert_equal 4, Coverage.result[tmp + '/test2.rb'].size } } ensure -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/