Fix IRB tests (#8925)

* Revert "Fixup da2c2931a60"

This reverts commit e1978a905a32af2d48b6e9efb6d0fe1656fddc5b.

* Revert "Skip Type completion tests related with IRB::VERSION"

This reverts commit da2c2931a602da22bc1fd10dc41f5c3a117bf502.

* require irb/version to test IRB::VERSION

---------

Co-authored-by: tompng <tomoyapenguin@gmail.com>
This commit is contained in:
Hiroshi SHIBATA 2023-11-15 14:58:51 +09:00 committed by GitHub
parent e1978a905a
commit 536649f819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View File

@ -10,7 +10,7 @@ rescue LoadError
return
end
require 'irb/version'
require 'irb/completion'
require 'irb/type_completion/completor'
require_relative '../helper'
@ -445,20 +445,20 @@ module TestIRB
assert_call('class A; X=1; class B; X=""; X.', include: String, exclude: Integer)
assert_call('class A; X=1; class B; X=""; end; X.', include: Integer, exclude: String)
assert_call('class A; class B; X=1; end; end; class A; class B; X.', include: Integer)
assert_call('module IRB; VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; IRB::VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; VERSION.', include: String)
assert_call('module IRB; IRB::VERSION.', include: String)
assert_call('module IRB; VERSION=1; VERSION.', include: Integer)
assert_call('module IRB; VERSION=1; IRB::VERSION.', include: Integer)
assert_call('module IRB; module A; VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; module A; VERSION.', include: String)
assert_call('module IRB; module A; VERSION=1; VERSION.', include: Integer)
assert_call('module IRB; module A; VERSION=1; IRB::VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; module A; VERSION=1; end; VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; module A; VERSION=1; IRB::VERSION.', include: String)
assert_call('module IRB; module A; VERSION=1; end; VERSION.', include: String)
assert_call('module IRB; IRB=1; IRB.', include: Integer)
assert_call('module IRB; IRB=1; ::IRB::VERSION.', include: String) if defined?(IRB::VERSION)
assert_call('module IRB; IRB=1; ::IRB::VERSION.', include: String)
module_binding = eval 'module ::IRB; binding; end'
assert_call('VERSION.', include: NilClass)
assert_call('VERSION.', include: String, binding: module_binding) if defined?(IRB::VERSION)
assert_call('IRB::VERSION.', include: String, binding: module_binding) if defined?(IRB::VERSION)
assert_call('VERSION.', include: String, binding: module_binding)
assert_call('IRB::VERSION.', include: String, binding: module_binding)
assert_call('A = 1; module M; A += 0.5; A.', include: Float)
assert_call('::A = 1; module M; A += 0.5; A.', include: Float)
assert_call('::A = 1; module M; A += 0.5; ::A.', include: Integer)

View File

@ -10,6 +10,7 @@ rescue LoadError
return
end
require 'irb/version'
require 'irb/type_completion/completor'
require_relative '../helper'
@ -89,7 +90,7 @@ module TestIRB
def test_const
assert_completion('Ar', include: 'Array')
assert_completion('::Ar', include: 'Array')
assert_completion('IRB::V', include: 'VERSION') if defined?(IRB::VERSION)
assert_completion('IRB::V', include: 'VERSION')
assert_completion('FooBar=1; F', include: 'FooBar')
assert_completion('::FooBar=1; ::F', include: 'FooBar')
assert_doc_namespace('Array', 'Array')