[macruby-changes] [1268] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 30 11:13:14 PDT 2009
Revision: 1268
http://trac.macosforge.org/projects/ruby/changeset/1268
Author: pthomson at apple.com
Date: 2009-03-30 11:13:14 -0700 (Mon, 30 Mar 2009)
Log Message:
-----------
Added another working spec.
Modified Paths:
--------------
MacRuby/branches/experimental/io.c
MacRuby/branches/experimental/rakelib/spec.rake
Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c 2009-03-30 17:06:29 UTC (rev 1267)
+++ MacRuby/branches/experimental/io.c 2009-03-30 18:13:14 UTC (rev 1268)
@@ -2620,11 +2620,23 @@
rb_io_initialize(VALUE io, SEL sel, int argc, VALUE *argv)
{
VALUE file_descriptor, mode;
- int mode_flags;
- rb_io_t *io_struct = ExtractIOStruct(io);
+ int mode_flags, fd;
+ struct stat st;
rb_scan_args(argc, argv, "11", &file_descriptor, &mode);
+
+ rb_io_t *io_struct = ExtractIOStruct(io);
+ file_descriptor = rb_check_to_integer(file_descriptor, "to_int");
+ if (NIL_P(file_descriptor)) {
+ rb_raise(rb_eTypeError, "can't convert %s into Integer", rb_obj_classname(file_descriptor));
+ }
+ fd = FIX2INT(file_descriptor);
+
+ if (fstat(fd, &st) < 0) {
+ rb_sys_fail(0);
+ }
+
mode_flags = (NIL_P(mode) ? FMODE_READABLE : convert_mode_string_to_fmode(mode));
- prepare_io_from_fd(io_struct, FIX2INT(file_descriptor), mode_flags);
+ prepare_io_from_fd(io_struct, fd, mode_flags);
return io;
}
Modified: MacRuby/branches/experimental/rakelib/spec.rake
===================================================================
--- MacRuby/branches/experimental/rakelib/spec.rake 2009-03-30 17:06:29 UTC (rev 1267)
+++ MacRuby/branches/experimental/rakelib/spec.rake 2009-03-30 18:13:14 UTC (rev 1268)
@@ -31,6 +31,7 @@
closed
to_i
to_io
+ initialize
}
desc "Run all language known good spec files which should be fully green (does not use tags)"
@@ -59,7 +60,7 @@
desc "Try to run IO tests"
task :io do
files = FileList["spec/frozen/core/io/{#{KNOWN_GOOD_CORE_IO.join(',')}}_spec.rb"]
- sh "./miniruby -v -I./mspec/lib -I./lib ./mspec/bin/mspec-run #{files.join(' ')}"
+ sh "./miniruby -v -I./mspec/lib -I./lib ./mspec/bin/mspec-run -f s #{files.join(' ')}"
end
desc "Run language examples that are known to fail"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090330/b14a3982/attachment.html>
More information about the macruby-changes
mailing list