Skip to content
Snippets Groups Projects
Commit a92f1a12 authored by rvm's avatar rvm
Browse files

Silence "already initialized constant warnings" which can happen if another

readline was required previously such as via "irb".
parent 1534923f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -5,6 +5,17 @@
module Readline
# Suppress warnings. The main one we encounter is "already initialized
# constant" because perhaps another version readline has done that already.
def suppress_warnings
original_verbosity = $VERBOSE
$VERBOSE = nil
result = yield
$VERBOSE = original_verbosity
return result
end
module_function :suppress_warnings
require 'rbreadline'
include RbReadline
Loading
Loading
@@ -444,7 +455,7 @@ module Readline
end
HISTORY = History
suppress_warnings { HISTORY = History }
# The Fcomp class provided to encapsulate typical filename completion
# procedure. You will not typically use this directly, but will instead
Loading
Loading
@@ -473,7 +484,7 @@ module Readline
end
end
FILENAME_COMPLETION_PROC = Fcomp
suppress_warnings { FILENAME_COMPLETION_PROC = Fcomp }
# The Ucomp class provided to encapsulate typical filename completion
# procedure. You will not typically use this directly, but will instead
Loading
Loading
@@ -505,13 +516,13 @@ module Readline
end
end
USERNAME_COMPLETION_PROC = Ucomp
suppress_warnings {USERNAME_COMPLETION_PROC = Ucomp }
RbReadline.rl_readline_name = "Ruby"
RbReadline.using_history()
VERSION = RbReadline.rl_library_version
suppress_warnings { VERSION = RbReadline.rl_library_version }
module_function :readline
Loading
Loading
/*~
require 'rubygems'
require 'irb'
dir = File.dirname(__FILE__)
require "#{dir}/../lib/readline"
require 'test/unit'
require 'rbconfig'
def RbConfig.ruby
File.join(RbConfig::CONFIG['bindir'],
RbConfig::CONFIG['RUBY_INSTALL_NAME'] +
RbConfig::CONFIG['EXEEXT'])
end unless defined? RbConfig.ruby
class TestRequireOrder < Test::Unit::TestCase
def test_basic
dir = File.dirname(__FILE__)
output = `#{RbConfig.ruby} -I .. #{dir}/require-order.rb 2>&1`
assert(output.empty?,
"Running require-order should not produce any warnings, got:
#{output}")
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment