mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@a454137
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fc1f3f14d3
commit
9dc121cc57
143 changed files with 328 additions and 146 deletions
|
@ -865,4 +865,23 @@ describe "C-API String function" do
|
|||
@s.rb_String({"bar" => "foo"}).should == '{"bar"=>"foo"}'
|
||||
end
|
||||
end
|
||||
|
||||
describe "rb_string_value_cstr" do
|
||||
it "returns a non-null pointer for a simple string" do
|
||||
@s.rb_string_value_cstr("Hello").should == true
|
||||
end
|
||||
|
||||
it "returns a non-null pointer for a UTF-16 string" do
|
||||
@s.rb_string_value_cstr("Hello".encode('UTF-16BE')).should == true
|
||||
end
|
||||
|
||||
it "raises an error if a string contains a null" do
|
||||
lambda { @s.rb_string_value_cstr("Hello\0 with a null.") }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "raises an error if a UTF-16 string contains a null" do
|
||||
lambda { @s.rb_string_value_cstr("Hello\0 with a null.".encode('UTF-16BE')) }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue