Skip to content

Commit

Permalink
Add experimental warning
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Sep 15, 2023
1 parent 3403f52 commit e36ef22
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rbs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ def run_prototype(args, options)
merge = true
end
opts.on("--todo", "Generates only undefined methods compared to objects") do
Warning.warn("Geneating prototypes with `--todo` option is experimental\n", category: :experimental)
todo = true
end
opts.on("--method-owner CLASS", "Generate method prototypes if the owner of the method is [CLASS]") do |klass|
Expand Down
24 changes: 24 additions & 0 deletions test/rbs/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,30 @@ module A
end
end

def test_prototype__runtime__todo
Dir.mktmpdir do |dir|
Dir.chdir(dir) do
with_cli do |cli|
begin
old = $stderr
$stderr = cli.stderr
cli.run(%w(prototype runtime --todo ::Object))
ensure
$stderr = old
end

assert_equal <<~EOM, cli.stdout.string
EOM

assert_equal <<~EOM, cli.stderr.string
Geneating prototypes with `--todo` option is experimental
EOM
end
end
end
end


def test_test
Dir.mktmpdir do |dir|
dir = Pathname(dir)
Expand Down

0 comments on commit e36ef22

Please sign in to comment.