Explicitly place a regular expression
Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
This commit is contained in:
parent
0f6c647b1a
commit
f220866c39
Notes:
git
2025-03-18 16:29:18 +00:00
@ -25,7 +25,7 @@ describe "SystemCallError.new" do
|
|||||||
@example_errno_class = Errno::EINVAL
|
@example_errno_class = Errno::EINVAL
|
||||||
@last_known_errno = Errno.constants.size - 1
|
@last_known_errno = Errno.constants.size - 1
|
||||||
@unknown_errno = Errno.constants.size
|
@unknown_errno = Errno.constants.size
|
||||||
@some_human_readable = "[[:graph:]]+"
|
@some_human_readable = /[[:graph:]]+/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires at least one argument" do
|
it "requires at least one argument" do
|
||||||
@ -97,11 +97,11 @@ describe "SystemCallError.new" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "sets an 'unknown error' message when an unknown error number" do
|
it "sets an 'unknown error' message when an unknown error number" do
|
||||||
SystemCallError.new(-1).message.should =~ Regexp.new(@some_human_readable)
|
SystemCallError.new(-1).message.should =~ @some_human_readable
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adds a custom error message to an 'unknown error' message when an unknown error number and a custom message specified" do
|
it "adds a custom error message to an 'unknown error' message when an unknown error number and a custom message specified" do
|
||||||
SystemCallError.new("custom message", -1).message.should =~ Regexp.new("#{@some_human_readable}.* - custom message")
|
SystemCallError.new("custom message", -1).message.should =~ /#{@some_human_readable}.* - custom message/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "converts to Integer if errno is a Complex convertible to Integer" do
|
it "converts to Integer if errno is a Complex convertible to Integer" do
|
||||||
@ -142,7 +142,7 @@ describe "SystemCallError#message" do
|
|||||||
SystemCallError.new(2**28).message.should =~ /Error .*occurred/i
|
SystemCallError.new(2**28).message.should =~ /Error .*occurred/i
|
||||||
end
|
end
|
||||||
platform_is_not :aix do
|
platform_is_not :aix do
|
||||||
SystemCallError.new(2**28).message.should =~ Regexp.new(@some_human_readable)
|
SystemCallError.new(2**28).message.should =~ @some_human_readable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user