зеркало из https://github.com/github/ruby.git
Extract IO::Buffer.for string locking test (#8729)
String locking with locktmp is not really part of the public API, and the test relies in a side effect of using it to protect the buffer. On other implementations without locktmp this does not fail. Separate into its own test so it can be excluded from public API expectations.
This commit is contained in:
Родитель
8a88172fd4
Коммит
0e62802c3b
|
@ -102,11 +102,6 @@ class TestIOBuffer < Test::Unit::TestCase
|
|||
IO::Buffer.for(string) do |buffer|
|
||||
refute buffer.readonly?
|
||||
|
||||
# Cannot modify string as it's locked by the buffer:
|
||||
assert_raise RuntimeError do
|
||||
string[0] = "h"
|
||||
end
|
||||
|
||||
buffer.set_value(:U8, 0, "h".ord)
|
||||
|
||||
# Buffer releases it's ownership of the string:
|
||||
|
@ -116,6 +111,16 @@ class TestIOBuffer < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_string_mapped_buffer_locked
|
||||
string = "Hello World"
|
||||
IO::Buffer.for(string) do |buffer|
|
||||
# Cannot modify string as it's locked by the buffer:
|
||||
assert_raise RuntimeError do
|
||||
string[0] = "h"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_non_string
|
||||
not_string = Object.new
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче