summaryrefslogtreecommitdiff
path: root/jni/ruby/test/irb
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/test/irb
Fresh start
Diffstat (limited to 'jni/ruby/test/irb')
-rw-r--r--jni/ruby/test/irb/test_completion.rb21
-rw-r--r--jni/ruby/test/irb/test_option.rb11
-rw-r--r--jni/ruby/test/irb/test_raise_no_backtrace_exception.rb13
3 files changed, 45 insertions, 0 deletions
diff --git a/jni/ruby/test/irb/test_completion.rb b/jni/ruby/test/irb/test_completion.rb
new file mode 100644
index 0000000..eeeda12
--- /dev/null
+++ b/jni/ruby/test/irb/test_completion.rb
@@ -0,0 +1,21 @@
+require 'test/unit'
+
+module TestIRB
+ class TestCompletion < Test::Unit::TestCase
+ def test_nonstring_module_name
+ begin
+ require "irb/completion"
+ bug5938 = '[ruby-core:42244]'
+ cmds = %W[-rirb -rirb/completion -e IRB.setup(__FILE__)
+ -e IRB.conf[:MAIN_CONTEXT]=IRB::Irb.new.context
+ -e module\sFoo;def\sself.name;//;end;end
+ -e IRB::InputCompletor::CompletionProc.call("[1].first.")
+ -- -f --]
+ status = assert_in_out_err(cmds, "", //, [], bug5938)
+ assert(status.success?, bug5938)
+ rescue LoadError
+ skip "cannot load irb/completion"
+ end
+ end
+ end
+end
diff --git a/jni/ruby/test/irb/test_option.rb b/jni/ruby/test/irb/test_option.rb
new file mode 100644
index 0000000..a7dd663
--- /dev/null
+++ b/jni/ruby/test/irb/test_option.rb
@@ -0,0 +1,11 @@
+require 'test/unit'
+
+module TestIRB
+ class TestOption < Test::Unit::TestCase
+ def test_end_of_option
+ bug4117 = '[ruby-core:33574]'
+ status = assert_in_out_err(%w[-rirb -e IRB.start(__FILE__) -- -f --], "", //, [], bug4117)
+ assert(status.success?, bug4117)
+ end
+ end
+end
diff --git a/jni/ruby/test/irb/test_raise_no_backtrace_exception.rb b/jni/ruby/test/irb/test_raise_no_backtrace_exception.rb
new file mode 100644
index 0000000..67fb5b6
--- /dev/null
+++ b/jni/ruby/test/irb/test_raise_no_backtrace_exception.rb
@@ -0,0 +1,13 @@
+require 'test/unit'
+
+module TestIRB
+ class TestRaiseNoBacktraceException < Test::Unit::TestCase
+ def test_raise_exception
+ status = assert_in_out_err(%w[-rirb -e IRB.start(__FILE__) -- -f --], <<-IRB, /Exception: foo/, [])
+ e = Exception.new("foo")
+ def e.backtrace; nil; end
+ raise e
+IRB
+ end
+ end
+end