kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
blob 5abbf0087930a9833ce9de108e9ccd1b14bf0ef2 561 bytes (raw)
name: test/test_singleton_read_write.rb 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
require 'test/unit'
$-w = true
require 'kgio'

class TestSingletonReadWrite < Test::Unit::TestCase

  def test_unix_socketpair
    a, b = UNIXSocket.pair
    assert_nothing_raised { Kgio.trywrite(a, "HELLO") }
    buf = ""
    assert_equal "HELLO", Kgio.tryread(b, 5, buf)
    assert_equal "HELLO", buf
    assert_equal :wait_readable, Kgio.tryread(b, 5)
  end

  def test_arg_error
    assert_raises(ArgumentError) { Kgio.tryread }
    assert_raises(ArgumentError) { Kgio.tryread($stdin) }
    assert_raises(ArgumentError) { Kgio.trywrite($stdout) }
  end
end

debug log:

solving 5abbf00 ...
found 5abbf00 in https://yhbt.net/kgio.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).