This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit/assertions.rb' | |
include Test::Unit::Assertions | |
require 'stringio' | |
f = StringIO.new("foo\nbar\nbaz\n") | |
assert_equal("fo", f.gets(nil, 2)) | |
assert_equal("o\n", f.gets('', 2)) | |
assert_equal(4, f.tell) | |
f = StringIO.new("foo\nbar\n\nbaz\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multiple, concurrent SSL requests | |
# | |
# works in Ruby 1.9.2, but Segfaults in Macruby 0.10 | |
require 'net/http';require "net/https" | |
def do_https | |
http=Net::HTTP.new('www.paypal.com', 443) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* before | |
$ macruby bm_string_match.rb | |
Rehearsal ------------------------------------ | |
0.670000 0.000000 0.670000 ( 0.484087) | |
--------------------------- total: 0.670000sec | |
user system total real | |
0.670000 0.010000 0.680000 ( 0.487022) | |
* after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test/net/imap/test_imap.rb:99: skip("[BUG : #???] Abort") => Works | |
test/net/imap/test_imap.rb:199: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/rinda/test_rinda.rb:243: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/rinda/test_rinda.rb:267: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/rinda/test_rinda.rb:297: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/rinda/test_rinda.rb:325: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/ruby/test_bignum.rb:278: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/ruby/test_bignum.rb:424: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/ruby/test_class.rb:241: skip("[BUG : #???] Timeout, MacRuby don't finish") | |
test/ruby/test_complex2.rb:6: skip("[BUG : #???] Segfault") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h | |
index ad7b1cb..94d38ed 100644 | |
--- a/include/ruby/ruby.h | |
+++ b/include/ruby/ruby.h | |
@@ -146,22 +146,6 @@ typedef unsigned LONG_LONG ID; | |
#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK) | |
-#if __LP64__ | |
-#define VOODOO_DOUBLE(d) (*(VALUE*)(&d)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def initialize | |
@obj = true | |
if block_given? | |
yield | |
end | |
end | |
end | |
class Bar < Foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework 'Cocoa' | |
framework 'Foundation' | |
class Growl | |
GROWL_IS_READY = "Lend Me Some Sugar; I Am Your Neighbor!" | |
GROWL_NOTIFICATION_CLICKED = "GrowlClicked!" | |
GROWL_NOTIFICATION_TIMED_OUT = "GrowlTimedOut!" | |
GROWL_KEY_CLICKED_CONTEXT = "ClickedContext" | |
def initialize(app, notifications, icon = nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake spec:ci | |
(in /Users/watson/src/macruby-trunk) | |
rm -rf rubyspec_temp | |
./mspec/bin/mspec ci -B ./spec/macruby.mspec :full | |
MacRuby 0.11 (ruby 1.9.2) [universal-darwin10.3, x86_64] | |
.........*** Dispatch block exited prematurely because of an uncaught exception: | |
/Users/watson/src/macruby-trunk/mspec/lib/mspec/expectations/expectations.rb:15:in `fail_with:': Expected true to equal false (SpecExpectationNotMetError) | |
from /Users/watson/src/macruby-trunk/mspec/lib/mspec/matchers/base.rb:9:in `==:' | |
from /Users/watson/src/macruby-trunk/spec/macruby/core/gcd/semaphore_spec.rb:62:in `block' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ macruby -r require_relative.rb test/ruby/test_thread.rb -v | |
---------------------------------------- | |
Loaded suite test/ruby/test_thread | |
Started | |
TestThread#test_abort_on_exception: 5.09 s: E | |
TestThread#test_condvar: 0.06 s: . | |
TestThread#test_condvar_nolock: 0.09 s: . | |
TestThread#test_condvar_nolock_2: 0.02 s: . | |
TestThread#test_condvar_nolock_3: 0.02 s: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test_priority | |
c1 = c2 = 0 | |
t1 = Thread.new { loop { c1 += 1 } } | |
t1.priority = -1 | |
t2 = Thread.new { loop { c2 += 1 } } | |
t2.priority = -3 | |
assert_equal(-1, t1.priority) | |
assert_equal(-3, t2.priority) | |
sleep 0.5 | |
5.times do |