Skip to content

Commit

Permalink
Merge pull request #1302 from ruby/bins-default-to-test.rb
Browse files Browse the repository at this point in the history
All bin/ scripts which take filepaths default to "test.rb"
  • Loading branch information
jemmaissroff authored Aug 22, 2023
2 parents 84b37e0 + 93e28c7 commit 7150921
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/lex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

# Usage:
# bin/lex # defaults to test.rb
# bin/lex <filename>
# bin/lex -e "<source-code>"

Expand All @@ -12,7 +13,7 @@ require "yarp"
if ARGV[0] == "-e"
source = ARGV[1]
else
filepath = ARGV.first
filepath = ARGV.first || "test.rb"
source = File.read(filepath)
end

Expand Down
2 changes: 1 addition & 1 deletion bin/locals
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$:.unshift(File.expand_path("../lib", __dir__))
require "yarp"

source = ARGV[0] == "-e" ? ARGV[1] : File.read(ARGV[0])
source = ARGV[0] == "-e" ? ARGV[1] : File.read(ARGV[0] || "test.rb")

puts "CRuby:"
p YARP.const_get(:Debug).cruby_locals(source)
Expand Down
3 changes: 2 additions & 1 deletion bin/parse
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

# Usage:
# bin/parse # defaults to test.rb
# bin/parse <filename>
# bin/parse -e "<source-code>"

Expand All @@ -11,7 +12,7 @@ require "yarp"
if ARGV[0] == "-e"
result = YARP.parse(ARGV[1])
else
result = YARP.parse_file(ARGV[0])
result = YARP.parse_file(ARGV[0] || "test.rb")
end

result.mark_newlines if ENV['MARK_NEWLINES']
Expand Down

0 comments on commit 7150921

Please sign in to comment.