-
-
Notifications
You must be signed in to change notification settings - Fork 399
Add and update specs for IO methods #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4a7d459
976d046
6f9fba9
a8dd789
d91bdf7
40e859f
3a69b22
f0a3b5f
46f9838
538111f
950b6cc
09eb335
18069f9
e1b1972
c9449cb
5694592
7008f3b
0749bb7
40f33d2
b9fa9e5
5309d09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,22 @@ | |
| it "raises an IOError on closed stream" do | ||
| -> { IOSpecs.closed_io.getbyte }.should.raise(IOError) | ||
| end | ||
|
|
||
| it "reads after ungetc without character conversion" do | ||
| @io.set_encoding("utf-8") | ||
| c = @io.getc | ||
| @io.ungetc(c) | ||
| @io.getbyte.should == 86 | ||
| end | ||
|
|
||
| it "raises an exception after ungetc with character conversion" do | ||
| @io.set_encoding("utf-8:utf-16be") | ||
| c = @io.getc | ||
| @io.ungetc(c) | ||
| -> do | ||
| @io.getbyte | ||
| end.should.raise(IOError, "byte oriented read for character buffered IO") | ||
| end | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: this appears to be a CRuby-specific implementation detail (or an intentional design constraint) that other Ruby implementations, such as JRuby, TruffleRuby, or Natalie, might handle differently (e.g., by CRuby already allows mixing byte-oriented and character-oriented read operations on streams with multibyte encodings (such as UTF-16BE). Semantically, calling
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that this project documents the behavior of CRuby, and this is indeed a CRuby behavior. I've not tried it on other implementations. Is that a requirement now? |
||
| end | ||
|
|
||
| describe "IO#getbyte" do | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.