Project

General

Profile

Misc #11732 » 0001-Add-a-test-case-for-test_restarting_coverage.patch

yui-knk (Kaneko Yuichiro), 11/23/2015 11:03 AM

View differences:

test/coverage/test_coverage.rb
55 55
          EOS
56 56
        end
57 57

  
58
        File.open("test2.rb", "w") do |f|
59
          f.puts <<-EOS
60
            def coverage_test_method2
61
              :ok
62
              :ok
63
            end
64
          EOS
65
        end
66

  
58 67
        Coverage.start
59 68
        require tmp + '/test.rb'
60 69
        assert_equal 3, Coverage.result[tmp + '/test.rb'].size
70

  
71
        # Restart coverage but '/test.rb' is required before restart,
72
        # so coverage is not recorded.
61 73
        Coverage.start
62 74
        coverage_test_method
63 75
        assert_equal 0, Coverage.result[tmp + '/test.rb'].size
76

  
77
        # Restart coverage and '/test2.rb' is required after restart,
78
        # so coverage is recorded.
79
        Coverage.start
80
        require tmp + '/test2.rb'
81
        assert_equal 4, Coverage.result[tmp + '/test2.rb'].size
64 82
      }
65 83
    }
66 84
  ensure
67
-