summaryrefslogtreecommitdiff
path: root/test/irb/test_context.rb
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2022-11-03 22:13:07 +0000
committergit <svn-admin@ruby-lang.org>2022-11-03 22:13:11 +0000
commita9232038119f2401e6c3d3a4946114b1e878afb5 (patch)
tree14465474a9e8aa589bd793d42d96dfbd58c91214 /test/irb/test_context.rb
parenta13836e70d9cc2eb569911030cbd735d68b4042c (diff)
downloadruby-a9232038119f2401e6c3d3a4946114b1e878afb5.tar.gz
[ruby/irb] Provide a base test class and let tests restore encodings
conveniently (https://github.com/ruby/irb/pull/429) * Create a base TestIRB::TestCase class * Save/restore encodings for tests that initializes InputMethod classes Because `RelineInputMethod#initializes` calls `set_encoding`, which changes stdio/out/err and Encoding's default encoding values, we need to make sure any test that directly or indirectly (e.g. through Context) initializes `RelineInputMethod` restores encodings. `ReadlineInputMethod` also changes encodings but currently no tests cover it. * Remove unnecessary TestHelper module Since we now have a base TestCase, without_rdoc can just live there. https://github.com/ruby/irb/commit/c2874ec121
Diffstat (limited to 'test/irb/test_context.rb')
-rw-r--r--test/irb/test_context.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb
index 998cdd8591..e7cc0bab4f 100644
--- a/test/irb/test_context.rb
+++ b/test/irb/test_context.rb
@@ -1,11 +1,12 @@
# frozen_string_literal: false
-require 'test/unit'
require 'tempfile'
require 'irb'
require 'rubygems' if defined?(Gem)
+require_relative "helper"
+
module TestIRB
- class TestContext < Test::Unit::TestCase
+ class TestContext < TestCase
class TestInputMethod < ::IRB::InputMethod
attr_reader :list, :line_no