[macruby-changes] [1275] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 30 16:10:33 PDT 2009


Revision: 1275
          http://trac.macosforge.org/projects/ruby/changeset/1275
Author:   pthomson at apple.com
Date:     2009-03-30 16:10:32 -0700 (Mon, 30 Mar 2009)
Log Message:
-----------
Added several more passing specs. By the way, type 'rake spec:io' to run them.

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c
    MacRuby/branches/experimental/rakelib/spec.rake
    MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb
    MacRuby/branches/experimental/spec/frozen/core/io/readline_spec.rb

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-03-30 23:01:50 UTC (rev 1274)
+++ MacRuby/branches/experimental/io.c	2009-03-30 23:10:32 UTC (rev 1275)
@@ -663,7 +663,6 @@
 {
     rb_io_t *io_struct = ExtractIOStruct(io);
     rb_io_assert_readable(io_struct); 
-    rb_io_assert_writable(io_struct);
 
     // TODO: make this work with IO::SEEK_CUR, SEEK_END, etc.
     rb_io_read_stream_set_offset(io_struct->readStream, FIX2LONG(offset));
@@ -1210,7 +1209,7 @@
     VALUE sep, limit;
     rb_scan_args(argc, argv, "02", &sep, &limit);
     rb_io_t *io_struct = ExtractIOStruct(io);
-
+	rb_io_assert_readable(io_struct);
     if (rb_io_eof(io, 0) == Qtrue) {
 	return Qnil;
     }
@@ -2028,7 +2027,7 @@
     
     FILE *process = macruby_popen(StringValueCStr(process_name), RSTRING_PTR(mode), &popen_pid);
     if (process == NULL) {
-        rb_raise(rb_eIOError, "system call to popen() failed");
+		rb_sys_fail("call to popen() failed.");
     }
     
     VALUE io = prep_io(fileno(process), convert_mode_string_to_fmode(mode), klass);

Modified: MacRuby/branches/experimental/rakelib/spec.rake
===================================================================
--- MacRuby/branches/experimental/rakelib/spec.rake	2009-03-30 23:01:50 UTC (rev 1274)
+++ MacRuby/branches/experimental/rakelib/spec.rake	2009-03-30 23:10:32 UTC (rev 1275)
@@ -30,8 +30,11 @@
   KNOWN_GOOD_CORE_IO = %w{
     closed
     fileno
+    io
     inspect
+    putc
     readchar
+    readline
     to_i
     to_io
     initialize
@@ -56,12 +59,12 @@
     sh "./mspec/bin/mspec ci -B ./spec/frozen/macruby.mspec spec/frozen/language #{KNOWN_GOOD_CORE_IO_FILES.join(' ')}"
   end
   
-  desc "Try to run IO tests"
+  desc "Run IO test with GDB enabled"
   task :gdbio do
     sh "gdb --args ./miniruby -v -I./mspec/lib -I./lib ./mspec/bin/mspec-run #{KNOWN_GOOD_CORE_IO_FILES.join(' ')}"
   end
   
-  desc "Try to run IO tests"
+  desc "Run the IO tests that pass"
   task :io do
     sh "./miniruby -v -I./mspec/lib -I./lib ./mspec/bin/mspec-run -f s #{KNOWN_GOOD_CORE_IO_FILES.join(' ')}"
   end

Modified: MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb	2009-03-30 23:01:50 UTC (rev 1274)
+++ MacRuby/branches/experimental/spec/frozen/core/io/getc_spec.rb	2009-03-30 23:10:32 UTC (rev 1275)
@@ -12,12 +12,12 @@
   end
 
   it "returns the next byte from the stream" do
-    @file.getc.should == 86
-    @file.getc.should == 111
-    @file.getc.should == 105
+    @file.getc.should == 'V'
+    @file.getc.should == 'o'
+    @file.getc.should == 'i'
     # read the rest of line
     @file.readline.should == "ci la ligne une.\n"
-    @file.getc.should == 81
+    @file.getc.should == 'Q'
   end
 
   it "returns nil when invoked at the end of the stream" do

Modified: MacRuby/branches/experimental/spec/frozen/core/io/readline_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/readline_spec.rb	2009-03-30 23:01:50 UTC (rev 1274)
+++ MacRuby/branches/experimental/spec/frozen/core/io/readline_spec.rb	2009-03-30 23:10:32 UTC (rev 1275)
@@ -31,7 +31,7 @@
   it "raises EOFError on end of stream" do
     testfile = File.dirname(__FILE__) + '/fixtures/gets.txt'
     File.open(testfile, 'r') do |f|
-      lambda { loop { f.readline } }.should raise_error(EOFError)
+      lambda { while true; f.readline; end }.should raise_error(EOFError)
     end
 
   end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090330/c483b7a1/attachment-0001.html>


More information about the macruby-changes mailing list