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

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 27 10:57:19 PDT 2009


Revision: 2099
          http://trac.macosforge.org/projects/ruby/changeset/2099
Author:   pthomson at apple.com
Date:     2009-07-27 10:57:18 -0700 (Mon, 27 Jul 2009)
Log Message:
-----------
Fixed an incompatibility that showed up in switching between libedit and GNU readline.

Modified Paths:
--------------
    MacRuby/branches/experimental/ext/readline/readline.c
    MacRuby/branches/experimental/spec/frozen/library/readline/history/element_reference_spec.rb

Removed Paths:
-------------
    MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/each_tags.txt
    MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_reference_tags.txt
    MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_set_tags.txt

Modified: MacRuby/branches/experimental/ext/readline/readline.c
===================================================================
--- MacRuby/branches/experimental/ext/readline/readline.c	2009-07-27 06:19:44 UTC (rev 2098)
+++ MacRuby/branches/experimental/ext/readline/readline.c	2009-07-27 17:57:18 UTC (rev 2099)
@@ -532,7 +532,7 @@
     if (i < 0) {
         i += history_length;
     }
-    entry = history_get(history_base + i);
+    entry = history_get(history_base + i - 1);
     if (entry == NULL) {
 	rb_raise(rb_eIndexError, "invalid index");
     }
@@ -640,7 +640,7 @@
 
     rb_secure(4);
     for (i = 0; i < history_length; i++) {
-        entry = history_get(history_base + i);
+        entry = history_get(history_base + i - 1);
         if (entry == NULL)
             break;
 	rb_yield(rb_tainted_str_new2(entry->line));

Modified: MacRuby/branches/experimental/spec/frozen/library/readline/history/element_reference_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/readline/history/element_reference_spec.rb	2009-07-27 06:19:44 UTC (rev 2098)
+++ MacRuby/branches/experimental/spec/frozen/library/readline/history/element_reference_spec.rb	2009-07-27 17:57:18 UTC (rev 2099)
@@ -31,9 +31,14 @@
       end
 
       it "raises an IndexError when there is no item at the passed index" do
-        lambda { Readline::HISTORY[-10] }.should raise_error(IndexError)
-        lambda { Readline::HISTORY[-9] }.should raise_error(IndexError)
-        lambda { Readline::HISTORY[-8] }.should raise_error(IndexError)
+        # When asking for negative indices from readline's history on
+        # libedit (which MacRuby uses), readline behaves more like a Ruby array
+        # and returns indices counting from the end.
+        not_compliant_on :macruby do
+          lambda { Readline::HISTORY[-10] }.should raise_error(IndexError)
+          lambda { Readline::HISTORY[-9] }.should raise_error(IndexError)
+          lambda { Readline::HISTORY[-8] }.should raise_error(IndexError)
+        end
 
         lambda { Readline::HISTORY[8] }.should raise_error(IndexError)
         lambda { Readline::HISTORY[9] }.should raise_error(IndexError)

Deleted: MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/each_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/each_tags.txt	2009-07-27 06:19:44 UTC (rev 2098)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/each_tags.txt	2009-07-27 17:57:18 UTC (rev 2099)
@@ -1 +0,0 @@
-fails:Readline::HISTORY.each yields each item in the history

Deleted: MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_reference_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_reference_tags.txt	2009-07-27 06:19:44 UTC (rev 2098)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_reference_tags.txt	2009-07-27 17:57:18 UTC (rev 2099)
@@ -1,2 +0,0 @@
-fails:Readline::HISTORY.[] returns the history item at the passed index
-fails:Readline::HISTORY.[] raises an IndexError when there is no item at the passed index

Deleted: MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_set_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_set_tags.txt	2009-07-27 06:19:44 UTC (rev 2098)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/library/readline/history/element_set_tags.txt	2009-07-27 17:57:18 UTC (rev 2099)
@@ -1 +0,0 @@
-fails:Readline::HISTORY.[]= sets the item at the given index
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090727/da9d2a75/attachment.html>


More information about the macruby-changes mailing list