summaryrefslogtreecommitdiff
path: root/test/readline/helper.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-05-14 07:00:03 +0900
committeraycabta <aycabta@gmail.com>2019-05-14 15:37:45 +0900
commitc754e979d3eeca51f1b13778f19f347df3da656e (patch)
treee419285e513f2e33f40636e7e7925cc5c962e4b9 /test/readline/helper.rb
parent07e7ae9ed78d0891a1c4755e2faf3c8d15d95102 (diff)
Test ext/readline and lib/reline by test/readline
Diffstat (limited to 'test/readline/helper.rb')
-rw-r--r--test/readline/helper.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/readline/helper.rb b/test/readline/helper.rb
new file mode 100644
index 0000000000..29b44996f1
--- /dev/null
+++ b/test/readline/helper.rb
@@ -0,0 +1,16 @@
+begin
+ require "readline.so"
+ ReadlineSo = Readline
+rescue LoadError
+end
+require "reline"
+
+def use_ext_readline # Use ext/readline as Readline
+ Object.send(:remove_const, :Readline) if Object.const_defined?(:Readline)
+ Object.const_set(:Readline, ReadlineSo)
+end
+
+def use_lib_reline # Use lib/reline as Readline
+ Object.send(:remove_const, :Readline) if Object.const_defined?(:Readline)
+ Object.const_set(:Readline, Reline)
+end