[#2529] concerns about Proc,lambda,block — "David A. Black" <dblack@...>
Hi --
>>>>> "D" == David A Black <dblack@wobblini.net> writes:
Hi --
Hi,
On Tue, 2 Mar 2004 08:44:25 +0900, Yukihiro Matsumoto wrote:
Hi,
On Wednesday, 3 March 2004 at 8:00:09 +0900, Yukihiro Matsumoto wrote:
Hi,
Hi,
On Wed, Mar 03, 2004 at 07:51:10AM +0900, Yukihiro Matsumoto wrote:
Hi,
On Thu, 4 Mar 2004, Yukihiro Matsumoto wrote:
Hi,
[#2575] Comment football being played... with lib/test/unit.rb — Nathaniel Talbott <nathaniel@...>
[Resent because I accidentally signed it the first time]
[#2577] problem with Net::HTTP in 1.8.1 — Ian Macdonald <ian@...>
Hello,
Hi,
[#2582] One more proc question — Dave Thomas <dave@...>
Sorry about this... :)
Hi,
On Friday, 5 March 2004 at 12:52:15 +0900, Yukihiro Matsumoto wrote:
Hi,
[#2588] Duck typing chapter — Dave Thomas <dave@...>
I've posted a rough first pass at a chapter about duck typing (and
[#2606] Thought about class definitions — Dave Thomas <dave@...>
If we allowed
[#2628] YAML complaint while generating RDoc — Dave Thomas <dave@...>
With the latest CVS, I get
[#2640] patch to tempfile.rb to handle ENAMETOOLONG — Joel VanderWerf <vjoel@...>
[#2644] RDoc proporsal — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Hi, rubyists.
[#2646] Problems rdoc'ing cvs... — Hugh Sasse Staff Elec Eng <hgs@...>
I have just done
On Friday, March 12, 2004, 4:15:42 AM, Dave wrote:
On Fri, 12 Mar 2004, Dave Thomas wrote:
[#2661] Pathological slowdown in 1.8 — Ryan Davis <ryand@...>
Hi all,
[#2697] lib/ruby/1.9/yaml.rb:193: [BUG] Segmentation fault — Mauricio Fern疣dez <batsman.geo@...>
Mauricio Fern疣dez wrote:
On Sun, Mar 28, 2004 at 09:42:42AM +0900, why the lucky stiff wrote:
[#2703] Proposed patch to add SSL support to net/pop.rb — Daniel Hobe <daniel@...>
This patch adds support to Net::POP for doing POP over SSL. Modeled on how
This is v2 of the patch. Cleaned up a bit and added some more docs.
v3 of the patch:
Hi,
I agree that there are a lot of arguments to #start, but I think it is the
On Tue, 30 Mar 2004 16:24:17 +0900, Daniel Hobe wrote:
On Wed, 31 Mar 2004 13:27:31 +0900, Daniel Hobe wrote:
On Tue, Mar 30, 2004 at 04:05:06PM +0900, Minero Aoki wrote:
[#2709] typos in lib/singleton.rb — Ian Macdonald <ian@...>
Hello,
[#2713] more spelling and grammar fixes — Ian Macdonald <ian@...>
Hello,
> Hello,
Hi,
test/scanf failure
Hi,
test/scanf/test_scanfio.rb fails at `make test-all', and
"iotest.dat" file remains. Also, it confused me to inspect
escaped string and eval it again.
Index: test/scanf/test_scanf.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/scanf/test_scanf.rb,v
retrieving revision 1.1
diff -u -2 -p -d -w -r1.1 test_scanf.rb
--- test/scanf/test_scanf.rb 1 Mar 2004 12:24:42 -0000 1.1
+++ test/scanf/test_scanf.rb 2 Mar 2004 02:34:29 -0000
@@ -6,5 +6,4 @@
#
-$:.unshift("..")
require 'scanf'
require 'test/unit'
@@ -53,5 +52,5 @@ def tests
[ "", "", [] ],
[ "", "abc 123", [] ],
- [ '%[^\\\\w]%c', "a...1", [] ],
+ [ '%[^\\w]%c', "a...1", [] ],
# Testing 'x'
@@ -98,11 +97,10 @@ def tests
# various mixed specifiers
- [ "%[^\\\\w]%c", "...1", [ "...", "1"] ],
- [ '%[^\\\\w]%c', "...1", [ "...", "1"] ],
+ [ "%[^\\w]%c", "...1", [ "...", "1"] ],
+ [ '%[^\\w]%c', "...1", [ "...", "1"] ],
[ "%[abc\n]%d", "a\n\nb\n\nc 123", [ "a\n\nb\n\nc", 123 ] ],
[ "%[abc\n]%d", "a\n\nb\n\nc \t 123", [ "a\n\nb\n\nc", 123 ] ],
[ "%[abc\t]%d", "a\t\tb\t\tc 123", [ "a\t\tb\t\tc", 123 ] ],
[ "%d%3[abc\n]", "123a\nbeaab", [ 123, "a\nb" ] ],
- [ "%d%3[abc\n]", "123a\\nbeaab", [ 123, "a\nb" ] ],
[ "%d%20c", "42 is the key", [ 42, " is the key" ] ],
[ "%d %20c", "42 is the key", [ 42, "is the key" ] ],
@@ -165,6 +163,6 @@ def tests
[ "%s%[ xyz]%d", "hello x 32", ["hello", " x ", 32] ],
[ "%5s%8[a-z]%d", "helloblahblah 32", ["hello", "blahblah", 32] ],
- [ '%s%[abcde\\\\s]%d', "hello badea 32", ["hello", " badea ", 32] ],
- [ '%d%[\\\\s]%c', "123 \n\t X", [ 123," \n\t ", "X"] ],
+ [ '%s%[abcde\\s]%d', "hello badea 32", ["hello", " badea ", 32] ],
+ [ '%d%[\\s]%c', "123 \n\t X", [ 123," \n\t ", "X"] ],
[ "%4s%2c%c", "1.2x\n\ny", [ "1.2x", "\n\n","y"] ],
[ "%f%c %3c%d", "1.2x\n\ny123", [ 1.2, "x", "y12", 3 ] ],
@@ -286,19 +284,15 @@ class TestStringScanf
extend ScanfTests
- def tes_f
+ def test_f
assert_equal(1.23e45.to_s, "1.23e45".scanf("%f")[0].to_s)
end
- i = 1
- tests = self.tests
- tests.each do |test|
- eval <<-EOE
- def test_#{i}
- assert_equal(#{test[2].inspect},"#{test[1]}".scanf("#{test[0]}"))
+ i = 1
+ self.tests.each do |test|
+ define_method("test_#{i}") do ||
+ assert_equal(test[2], test[1].scanf(test[0]))
end
- EOE
i += 1
end
-
end
@@ -308,16 +302,12 @@ class TestIOScanf
i = 1
- tests = self.tests
- tests.each do |test|
- str = <<-EOE
- def test_#{i}
- File.open("iotest.dat", "w") { |fh| fh.print "#{test[1]}" }
+ self.tests.each do |test|
+ define_method("test_#{i}") do ||
+ File.open("iotest.dat", "w") {|fh| fh.print test[1]}
File.open("iotest.dat", "r") { |fh|
- assert_equal(#{test[2].inspect},fh.scanf("#{test[0]}"))
+ assert_equal(test[2], fh.scanf(test[0]))
}
File.delete("iotest.dat")
end
- EOE
- eval str
i += 1
end
Index: test/scanf/test_scanfblocks.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/scanf/test_scanfblocks.rb,v
retrieving revision 1.1
diff -u -2 -p -d -w -r1.1 test_scanfblocks.rb
--- test/scanf/test_scanfblocks.rb 1 Mar 2004 12:24:42 -0000 1.1
+++ test/scanf/test_scanfblocks.rb 2 Mar 2004 02:36:10 -0000
@@ -6,9 +6,8 @@
-$:.unshift("..")
require 'test/unit'
-require 'scanf.rb'
+require 'scanf'
-class TestMe < Test::Unit::TestCase
+class TestScanfBlock < Test::Unit::TestCase
def setup
@@ -62,5 +61,6 @@ alias set_up setup
"Brahms was born in 1833." ],res)
fh.close
-# File.delete("iotest.dat")
+ ensure
+ File.delete("iotest.dat")
end
@@ -72,5 +72,6 @@ alias set_up setup
assert_equal(fh.scanf("%d%f%s") {}, [])
fh.close
- # File.delete("iotest.dat")
+ ensure
+ File.delete("iotest.dat")
end
Index: test/scanf/test_scanfio.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/scanf/test_scanfio.rb,v
retrieving revision 1.1
diff -u -2 -p -d -w -r1.1 test_scanfio.rb
--- test/scanf/test_scanfio.rb 1 Mar 2004 12:24:42 -0000 1.1
+++ test/scanf/test_scanfio.rb 2 Mar 2004 02:35:01 -0000
@@ -6,10 +6,14 @@
-$:.unshift("..")
-require "scanf.rb"
+require "scanf"
+
+class TestScanfIO
+ def test_io
+ fh = File.new(File.join(File.dirname(__FILE__), "data.txt"), "r")
+ assert_equal(0, fh.pos)
+ assert_equal(["this", "is"], fh.scanf("%s%s"))
+ assert_equal([33, "littel"], fh.scanf("%da fun%s"))
+ #p fh.pos
+ end
+end
-fh = File.new("data.txt", "r")
-p fh.pos
-p fh.scanf("%s%s")
-p fh.scanf("%da fun%s")
-p fh.pos
--
Nobu Nakada