[#4065] Surprise in Time#sec — Steven Jenkins <steven.jenkins@...>
This bit me:
[#4067] Segfault in Thread#initialize / caller — Florian Gro<florgro@...>
Moin!
[#4076] Ruby/DL — Jamis Buck <jamis_buck@...>
I recently used Ruby/DL to create bindings to the SQLite3 embedded
On Tue, Jan 04, 2005 at 02:53:49AM +0900, Jamis Buck wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
On Wed, Jan 05, 2005 at 03:05:48AM +0900, ts wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
On Thu, Jan 06, 2005 at 01:10:34AM +0900, ts wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
On Thu, Jan 06, 2005 at 06:57:57PM +0900, ts wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
On Fri, Jan 07, 2005 at 12:06:16AM +0900, ts wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
ts wrote:
[#4116] Test::Unit::Collector::Dir won't work with code that modifies $LOAD_PATH — Eric Hodel <drbrain@...7.net>
Any test code that depends upon modifications of $: fails when used
Hi,
On 11 Jan 2005, at 04:14, nobu.nokada@softhome.net wrote:
On 11 Jan 2005, at 09:39, Eric Hodel wrote:
On Sat, 15 Jan 2005 04:06:10 +0900, Eric Hodel <drbrain@segment7.net> wrote:
On Fri, 14 Jan 2005 23:48:58 -0500, Nathaniel Talbott
On Thu, 27 Jan 2005 17:17:14 -0500, Nathaniel Talbott
[#4146] The face of Unicode support in the future — Charles O Nutter <headius@...>
Hello Rubyists!
Hi,
Yukihiro Matsumoto <matz@ruby-lang.org> writes:
Paul Brannan <pbrannan@atdesk.com> writes:
Hi,
On Mon, Jan 10, 2005 at 11:53:48PM +0900, Yukihiro Matsumoto wrote:
Hi,
Yukihiro Matsumoto wrote:
Hi,
On Wed, Jan 12, 2005 at 02:13:35PM +0900, Yukihiro Matsumoto wrote:
Hi,
[#4189] Authenticated proxy support for open-uri — Neil Kohl <nakohl@...>
Hello!
[#4232] Carriage return on shebang — Florian Gro<florgro@...>
Moin.
[#4242] tracer.rb: Do not list pseudo source lines of binary extensions — Florian Gro<florgro@...>
Moin.
[#4243] Patch that enables https in open-uri.rb — Michael Neumann <mneumann@...>
Hi,
In article <41E93F42.9090705@ntecs.de>,
Tanaka Akira wrote:
[#4269] Re: The face of Unicode support in the future — Wes Nakamura <wknaka@...>
Hi,
Hi,
Yukihiro Matsumoto wrote:
Hi,
[#4296] parse_c.rb: allow whitespace after function names — Tilman Sauerbeck <tilman@...>
Hi,
Hi,
Yukihiro Matsumoto <matz@ruby-lang.org> [2005-01-21 17:43]:
[#4311] RFE: Enumerable#group_by, Array#^ — Florian Gro<florgro@...>
Moin.
[#4323] test/unit doesn't rescue a Exception — Tanaka Akira <akr@...17n.org>
test/unit doesn't rescue a Exception in a test method, as follows.
In article <87is5jb46q.fsf@serein.a02.aist.go.jp>,
On 9/1/06, Tanaka Akira <akr@fsij.org> wrote:
On Sep 2, 2006, at 6:34 PM, Nathaniel Talbott wrote:
In article <A604C0B3-95ED-4B9B-866C-79A2C7D5E3C4@segment7.net>,
On Sep 2, 2006, at 9:39 PM, Tanaka Akira wrote:
In article <622DAC7E-55DB-4854-B82B-A037CE9C75EF@segment7.net>,
In article <87ac5hv4bo.fsf@fsij.org>,
On Sep 3, 2006, at 8:21 AM, Tanaka Akira wrote:
[#4332] IO#clearerr missing in action — Eric Hodel <drbrain@...7.net>
I wanted to implement tail(1) in ruby cleanly, but found the best I
[#4335] When will Object#type disappear? — "David A. Black" <dblack@...>
Hi --
Re: Test::Unit::Collector::Dir won't work with code that modifies $LOAD_PATH
On Thu, 27 Jan 2005 17:17:14 -0500, Nathaniel Talbott <ntalbott@gmail.com> wrote: > As for fixing the dir collector so that it respects the $LOAD_PATH, > I'm not happy with the robustness of the solutions I've found so far. > The best solution would be to find a way to not modify $LOAD_PATH at > all, but I'm not sure if that's possible. Otherwise I'm stuck trying > to undo only the changes made for requiring a test file, but I don't > think there's a completely fool-proof way of doing that, and I'm > afraid of introducing weird corner-cases that look like they ought to > work but don't. Ideas? Attached is a new version of the patch that seems to resolve this issue completely, but it's so simple I'm thinking there has to be a gotcha. Basically, it doesn't modify $LOAD_PATH at all, but rather does a File.expand_path on the filename to get the absolute path and then depends on the fact that require will load an absolute pathname without regard to the $LOAD_PATH. In my simplistic tests this works fine, but I'm concerned I might be missing something. Feedback is (as always) welcome, and if no one comes up with any problems, I plan to commit it Monday. Thanks, -- Nathaniel <:((>< Terralien, Inc.
Attachments (1)
Index: ChangeLog
===================================================================
RCS file: /var/cvs/src/ruby/ChangeLog,v
retrieving revision 1.2673.2.812
diff -u -r1.2673.2.812 ChangeLog
--- ChangeLog 29 Jan 2005 05:14:08 -0000 1.2673.2.812
+++ ChangeLog 30 Jan 2005 01:32:13 -0000
@@ -1,3 +1,16 @@
+Sun Jan 30 10:27:00 2005 Nathaniel Talbott <ntalbott@ruby-lang.org>
+ * lib/test/unit/collector.rb (collect_file): no longer modifies the
+ $LOAD_PATH - instead expands the file path to determine the
+ absolute path and requires that.
+
+ * lib/test/unit/autorunner.rb (AutoRunner.run): fixed so that
+ 'ruby -rtest/unit -rtest1 -rtest2 -e0' will use the objectspace
+ collector again. Also tried to simplify the calling convention.
+
+ * test/runner.rb: adjusted for new AutoRunner semantics.
+
+ * lib/test/unit.rb: ditto.
+
Sat Jan 29 09:42:12 2005 Sam Roberts <sroberts@uniserve.com>
* lib/resolv.rb (Resolv::DNS::Resource::IN::SRV): Added RFC2782 SRV
Index: lib/test/unit.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/test/unit.rb,v
retrieving revision 1.7.2.5
diff -u -r1.7.2.5 unit.rb
--- lib/test/unit.rb 19 Dec 2004 02:01:58 -0000 1.7.2.5
+++ lib/test/unit.rb 30 Jan 2005 01:32:14 -0000
@@ -240,35 +240,35 @@
# class TS_MyTests
# def self.suite
# suite = Test::Unit::TestSuite.new
-# suite << TC_MyFirstTests.suite
-# suite << TC_MoreTestsByMe.suite
-# suite << TS_AnotherSetOfTests.suite
-# return suite
-# end
-# end
-# Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
-#
-# Now, this is a bit cumbersome, so Test::Unit does a little bit more
-# for you, by wrapping these up automatically when you require
-# 'test/unit'. What does this mean? It means you could write the above
-# test case like this instead:
-#
-# require 'test/unit'
-# require 'tc_myfirsttests'
-# require 'tc_moretestsbyme'
-# require 'ts_anothersetoftests'
-#
-# Test::Unit is smart enough to find all the test cases existing in
-# the ObjectSpace and wrap them up into a suite for you. It then runs
-# the dynamic suite using the console TestRunner.
-#
-#
-# == Questions?
-#
-# I'd really like to get feedback from all levels of Ruby
-# practitioners about typos, grammatical errors, unclear statements,
-# missing points, etc., in this document (or any other).
-#
+ # suite << TC_MyFirstTests.suite
+ # suite << TC_MoreTestsByMe.suite
+ # suite << TS_AnotherSetOfTests.suite
+ # return suite
+ # end
+ # end
+ # Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
+ #
+ # Now, this is a bit cumbersome, so Test::Unit does a little bit more
+ # for you, by wrapping these up automatically when you require
+ # 'test/unit'. What does this mean? It means you could write the above
+ # test case like this instead:
+ #
+ # require 'test/unit'
+ # require 'tc_myfirsttests'
+ # require 'tc_moretestsbyme'
+ # require 'ts_anothersetoftests'
+ #
+ # Test::Unit is smart enough to find all the test cases existing in
+ # the ObjectSpace and wrap them up into a suite for you. It then runs
+ # the dynamic suite using the console TestRunner.
+ #
+ #
+ # == Questions?
+ #
+ # I'd really like to get feedback from all levels of Ruby
+ # practitioners about typos, grammatical errors, unclear statements,
+ # missing points, etc., in this document (or any other).
+ #
module Unit
def self.run=(flag)
@run = flag
@@ -282,6 +282,6 @@
at_exit do
unless $! || Test::Unit.run?
- exit Test::Unit::AutoRunner.run($0 != "-e" && $0)
+ exit Test::Unit::AutoRunner.run
end
end
Index: lib/test/unit/autorunner.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/test/unit/autorunner.rb,v
retrieving revision 1.8.2.2
diff -u -r1.8.2.2 autorunner.rb
--- lib/test/unit/autorunner.rb 19 Dec 2004 02:01:58 -0000 1.8.2.2
+++ lib/test/unit/autorunner.rb 30 Jan 2005 01:32:14 -0000
@@ -5,14 +5,20 @@
module Test
module Unit
class AutoRunner
- def self.run(current_file=nil, default_dir=nil, argv=ARGV, &block)
- if(!current_file || current_file == $0)
- r = new(!current_file, &block)
- if !r.process_args(argv) && default_dir
- r.to_run << default_dir
- end
- r.run
+ def self.run(force_standalone=false, default_dir=nil, argv=ARGV, &block)
+ r = new(force_standalone || standalone?, &block)
+ if((!r.process_args(argv)) && default_dir)
+ r.to_run << default_dir
end
+ r.run
+ end
+
+ def self.standalone?
+ return false unless("-e" == $0)
+ ObjectSpace.each_object(Class) do |klass|
+ return false if(klass < TestCase)
+ end
+ true
end
RUNNERS = {
Index: lib/test/unit/collector/dir.rb
===================================================================
RCS file: /var/cvs/src/ruby/lib/test/unit/collector/dir.rb,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 dir.rb
--- lib/test/unit/collector/dir.rb 19 Dec 2004 02:01:59 -0000 1.4.2.1
+++ lib/test/unit/collector/dir.rb 30 Jan 2005 01:32:14 -0000
@@ -75,17 +75,13 @@
end
def collect_file(name, suites, already_gathered)
- loadpath = $:.dup
- dir = File.dirname(File.expand_path(name))
- $:.unshift(dir) unless $:.first == dir
+ absolute_name = File.expand_path(name)
if(@req)
- @req.require(name)
+ @req.require(absolute_name)
else
- require(name)
+ require(absolute_name)
end
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
- ensure
- $:.replace(loadpath)
end
end
end
Index: test/runner.rb
===================================================================
RCS file: /var/cvs/src/ruby/test/runner.rb,v
retrieving revision 1.11
diff -u -r1.11 runner.rb
--- test/runner.rb 2 Dec 2003 12:31:44 -0000 1.11
+++ test/runner.rb 30 Jan 2005 01:32:14 -0000
@@ -4,4 +4,4 @@
Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze
Release = rcsid[3].freeze
-exit Test::Unit::AutoRunner.run(false, File.dirname($0))
+exit Test::Unit::AutoRunner.run(true, File.dirname($0))