-
Notifications
You must be signed in to change notification settings - Fork 256
Add missing definitions for IO and system standard libraries (find, pathname, pty, stringio, timeout, zlib) #3171
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
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| %a{annotate:rdoc:skip} | ||
| module Zlib | ||
| # <!-- rdoc-file=ext/zlib/zlib.c --> | ||
| # Subclass of Zlib::Error. This error is raised when the zlib stream is | ||
| # currently in progress. | ||
| # | ||
| # For example: | ||
| # | ||
| # inflater = Zlib::Inflate.new | ||
| # inflater.inflate(compressed) do | ||
| # inflater.inflate(compressed) # Raises Zlib::InProgressError | ||
| # end | ||
| # | ||
| class InProgressError < Zlib::Error | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,29 @@ | ||
| require_relative "test_helper" | ||
|
|
||
| class StringIOSingletonTest < Test::Unit::TestCase | ||
| include TestHelper | ||
|
|
||
| library "stringio" | ||
| testing "singleton(::StringIO)" | ||
|
|
||
| def test_constants | ||
| assert_const_type "String", "StringIO::VERSION" | ||
| assert_const_type "Integer", "StringIO::MAX_LENGTH" | ||
| end | ||
|
Comment on lines
+9
to
12
Collaborator
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. Please use |
||
| end | ||
|
|
||
| class StringIOInstanceTest < Test::Unit::TestCase | ||
| include TestHelper | ||
|
|
||
| library "stringio" | ||
| testing "::StringIO" | ||
|
|
||
| def test_length | ||
| assert_send_type "() -> ::Integer", | ||
| StringIO.new("hello"), :length | ||
| end | ||
| end | ||
|
|
||
| class StringIOTest < StdlibTest | ||
| target StringIO | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,30 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require_relative "test_helper" | ||
| require "timeout" | ||
| require "bigdecimal" | ||
|
|
||
| class TimeoutSingletonTest < Test::Unit::TestCase | ||
| class TimeoutTest < Test::Unit::TestCase | ||
| include TestHelper | ||
|
|
||
| library "timeout" | ||
| testing "singleton(::Timeout)" | ||
|
|
||
| def test_version | ||
| assert_const_type "String", "Timeout::VERSION" | ||
| end | ||
|
|
||
| def test_timeout | ||
| proc = Proc.new { |sec| sec * sec } | ||
| assert_send_type "(::Integer sec) { (::Integer sec) -> ::Integer } -> ::Integer", | ||
| Timeout, :timeout, 5, &proc | ||
| assert_send_type "(::Float sec) { (::Float sec) -> ::Float } -> ::Float", | ||
| Timeout, :timeout, 1.2, &proc | ||
| assert_send_type "(::Rational sec) { (::Rational sec) -> ::Rational } -> ::Rational", | ||
| Timeout, :timeout, Rational(5, 3), &proc | ||
| assert_send_type "(::BigDecimal sec) { (::BigDecimal sec) -> ::BigDecimal } -> ::BigDecimal", | ||
| Timeout, :timeout, BigDecimal("1.123456789123456789"), &proc | ||
| assert_send_type "[T] (Numeric?, ?singleton(Exception), ?String) { (Numeric) -> T } -> T", | ||
| Timeout, :timeout, 1 do | ||
| 42 | ||
| end | ||
| end | ||
|
|
||
| def test_handle_timeout | ||
| res = Timeout::Error.handle_timeout("msg") do |exc| | ||
| assert_instance_of Timeout::ExitException, exc | ||
|
Collaborator
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. Please use |
||
| :ok | ||
| end | ||
| assert_equal :ok, res | ||
|
Collaborator
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. Please use |
||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,5 +75,10 @@ def test_zlib_version | |
| assert_send_type "() -> ::String", | ||
| Zlib, :zlib_version | ||
| end | ||
|
|
||
| def test_in_progress_error | ||
| assert_const_type "Class", "Zlib::InProgressError" | ||
| assert_equal Zlib::Error, Zlib::InProgressError.superclass | ||
|
Collaborator
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. Please use |
||
| end | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
assert_const_typeto test constants.