Created
February 8, 2011 21:48
-
-
Save calavera/817328 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
From 009c702252ebd9bffe9451300a076470feaab849 Mon Sep 17 00:00:00 2001 | |
From: David Calavera <[email protected]> | |
Date: Tue, 8 Feb 2011 22:49:39 +0100 | |
Subject: [PATCH] add spec to ensure IO#readpartial works with multibyte characters | |
--- | |
core/io/readpartial_spec.rb | 9 +++++++++ | |
1 files changed, 9 insertions(+), 0 deletions(-) | |
diff --git a/core/io/readpartial_spec.rb b/core/io/readpartial_spec.rb | |
index 2be3124..16cb08d 100644 | |
--- a/core/io/readpartial_spec.rb | |
+++ b/core/io/readpartial_spec.rb | |
@@ -1,3 +1,4 @@ | |
+# -*- encoding: ascii-8bit -*- | |
require File.expand_path('../../../spec_helper', __FILE__) | |
require File.expand_path('../fixtures/classes', __FILE__) | |
@@ -37,6 +38,14 @@ describe "IO#readpartial" do | |
@rd.readpartial(3).should == "bar" | |
end | |
+ it "reads after ungetc with multibyte characters in the buffer" do | |
+ @wr.write("∂φ/∂x = gaîté") | |
+ c = @rd.getc | |
+ @rd.ungetc(c) | |
+ @rd.readpartial(3).should == "\xE2\x88\x82" | |
+ @rd.readpartial(3).should == "\xCF\x86/" | |
+ end | |
+ | |
it "reads after ungetc without data in the buffer" do | |
@wr.write("f") | |
c = @rd.getc | |
-- | |
1.7.2.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment