ruby-changes:61263
From: Koichi <ko1@a...>
Date: Fri, 15 May 2020 14:54:22 +0900 (JST)
Subject: [ruby-changes:61263] e89b875081 (master): fix for multi-run test.
https://git.ruby-lang.org/ruby.git/commit/?id=e89b875081 From e89b87508160868bd431218872d0d5b7b15bc57b Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 15 May 2020 14:27:06 +0900 Subject: fix for multi-run test. TestAutoload#test_source_location can't run multiple test-run so that use assert_separately(). repro command: make yes-test-all TESTS='--repeat-count=50 ruby/test_autoload -n test_source_location' diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index 2e2e79d..98d513d 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -428,15 +428,18 @@ p Foo::Bar https://github.com/ruby/ruby/blob/trunk/test/ruby/test_autoload.rb#L428 end def test_source_location - klass = self.class bug = "Bug16764" Dir.mktmpdir('autoload') do |tmpdir| path = "#{tmpdir}/test-#{bug}.rb" - File.write(path, "#{klass}::#{bug} = __FILE__\n") - klass.autoload(:Bug16764, path) - assert_equal [__FILE__, __LINE__-1], klass.const_source_location(bug) - assert_equal path, klass.const_get(bug) - assert_equal [path, 1], klass.const_source_location(bug) + File.write(path, "C::#{bug} = __FILE__\n") + assert_separately(%W[-I #{tmpdir}], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + class C; end + C.autoload(:Bug16764, #{path.dump}) + assert_equal [__FILE__, __LINE__-1], C.const_source_location(#{bug.dump}) + assert_equal #{path.dump}, C.const_get(#{bug.dump}) + assert_equal [#{path.dump}, 1], C.const_source_location(#{bug.dump}) + end; end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/