[#67346] Future of test suites for Ruby — Charles Oliver Nutter <headius@...>

I'll try to be brief so we can discuss all this. tl;dr: RubySpec is

19 messages 2015/01/05

[ruby-core:67808] [ruby-trunk - Feature #4824] Provide method Kernel#executed?

From: nobu@...
Date: 2015-01-25 23:29:04 UTC
List: ruby-core #67808
Issue #4824 has been updated by Nobuyoshi Nakada.

Description updated

My proposal was `__FILE__.main?`, not `FILE.main?`.
Just you're confused by markdown.

----------------------------------------
Feature #4824: Provide method Kernel#executed?
https://bugs.ruby-lang.org/issues/4824#change-51218

* Author: Lazaridis Ilias
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
The current construct to execute main code looks not very elegant:

~~~ruby
if __FILE__ == $0
  my_main()          # call any method or execute any code
end
~~~

With a `Kernel#executed?` method, this would become more elegant:

~~~ruby
if executed?
  #do this
  #do that
  my_main()
end
~~~

or

~~~ruby
main() if executed?
~~~

This addition would not break any existent behaviour.




-- 
https://bugs.ruby-lang.org/

In This Thread