[ruby-cvs:67052] mame:r59874 (trunk): [EXPERIMENTAL] Extend the API of `Coverage.start` and `result`

mame at ruby-lang.org mame at ruby-lang.org
Thu Sep 14 11:36:27 JST 2017


mame	2017-09-14 11:36:26 +0900 (Thu, 14 Sep 2017)

  New Revision: 59874

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59874

  Log:
    [EXPERIMENTAL] Extend the API of `Coverage.start` and `result`
    
    The old API:
    
        Coverage.start
        load "foo.rb"
        p Coverage.result #=> {"foo.rb" => [1, 2, nil]}
    
    The new API:
    
        ENV["COVERAGE_EXPERIMENTAL_MODE"] = "true"
        Coverage.start(lines: true)
        load "foo.rb"
        p Coverage.result #=> {"foo.rb" => {:lines => [1, 2, nil]}}
    
    This new API allows us to add other measuring target types.
    
    Notes:
    
    * To keep compatibility, the old interface is still remained; passing no
      optional argument makes `Coverage.result` return the old format.
    * This feature is still experimental.  So, to enable the new API, the
      environment variable `COVERAGE_EXPERIMENTAL_MODE` must be set.  I plan
      to activate this feature by Ruby 2.5.

  Modified files:
    trunk/ext/coverage/coverage.c


More information about the ruby-cvs mailing list