*** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4477 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8c5c1e05b0
commit
3525f78b58
2 changed files with 44 additions and 3 deletions
|
|
@ -3,15 +3,23 @@
|
|||
|
||||
%inline %{
|
||||
|
||||
std::string test_value(std::string x) {
|
||||
std::string test_value_in(std::string x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::string *test_pointer(std::string *x) {
|
||||
std::string *test_pointer_in(std::string *x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::string test_reference(std::string &x) {
|
||||
const std::string *test_const_pointer_in(const std::string *x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::string test_reference_in(std::string &x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
std::string test_const_reference_in(const std::string &x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
|
|
|||
33
SWIG/Examples/test-suite/ruby/lib_std_string_runme.rb
Normal file
33
SWIG/Examples/test-suite/ruby/lib_std_string_runme.rb
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
require 'lib_std_string'
|
||||
|
||||
include Lib_std_string
|
||||
|
||||
# Checking expected use of %typemap(in) std::string {}
|
||||
test_value_in("Fee")
|
||||
|
||||
# Checking expected result of %typemap(out) std::string {}
|
||||
raise RuntimeError unless test_value_in("Fi") == "Fi"
|
||||
|
||||
# Verify type-checking for %typemap(in) std::string {}
|
||||
exceptionRaised = false
|
||||
begin
|
||||
test_value_in(0)
|
||||
rescue TypeError
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
||||
# Checking expected use of %typemap(in) const std::string & {}
|
||||
test_const_reference_in("Fo")
|
||||
|
||||
# Verify type-checking for %typemap(in) const std::string & {}
|
||||
exceptionRaised = false
|
||||
begin
|
||||
test_const_reference_in(0)
|
||||
rescue TypeError
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue