mirror of https://github.com/swig/swig
Expand director_string_runme.*
Fill in parts which were missing for some target languages.
This commit is contained in:
parent
ccf4f6ec72
commit
ccaf46262a
|
@ -3,7 +3,7 @@ using director_stringNamespace;
|
|||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
static void Main()
|
||||
{
|
||||
runme r = new runme();
|
||||
r.run();
|
||||
|
@ -22,6 +22,9 @@ public class runme
|
|||
|
||||
director_string_B b = new director_string_B("hello");
|
||||
|
||||
s = b.get_first();
|
||||
if (s != "director_string_B.get_first") throw new Exception("get_first() failed");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (s != "director_string_B.get_first") throw new Exception("call_get_first() failed");
|
||||
|
||||
|
@ -36,7 +39,7 @@ class director_string_B : A {
|
|||
public override String get_first() {
|
||||
return "director_string_B.get_first";
|
||||
}
|
||||
|
||||
|
||||
public override String get(int n) {
|
||||
return "director_string_B.get: " + base.get(n);
|
||||
}
|
||||
|
@ -50,4 +53,3 @@ class director_string_A : A {
|
|||
return nn.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ public class director_string_runme {
|
|||
|
||||
director_string_B b = new director_string_B("hello");
|
||||
|
||||
s = b.get_first();
|
||||
if (!s.equals("director_string_B.get_first")) throw new RuntimeException("get_first() failed");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed");
|
||||
|
||||
|
@ -39,7 +42,7 @@ class director_string_B extends A {
|
|||
public String get_first() {
|
||||
return "director_string_B.get_first";
|
||||
}
|
||||
|
||||
|
||||
public String get(int n) {
|
||||
return "director_string_B.get: " + super.get(n);
|
||||
}
|
||||
|
@ -53,4 +56,3 @@ class director_string_A extends A {
|
|||
return Integer.valueOf(n).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 7;
|
||||
BEGIN { use_ok 'director_string' }
|
||||
require_ok 'director_string';
|
||||
|
||||
|
@ -25,9 +25,10 @@ require_ok 'director_string';
|
|||
my $b = B->new("hello");
|
||||
isa_ok $b, 'B';
|
||||
|
||||
$b->get(0);
|
||||
is $b->get(0), "hello";
|
||||
|
||||
is $b->get_first(), "hello world!";
|
||||
is $b->get_first(), "hello world!";
|
||||
is $b->call_get_first(), "hello world!";
|
||||
|
||||
$b->call_process_func();
|
||||
|
||||
|
|
|
@ -24,8 +24,11 @@ class B extends A {
|
|||
|
||||
$b = new B("hello");
|
||||
|
||||
$b->get(0);
|
||||
check::equal($b->get_first(),"hello world!", "get_first failed");
|
||||
check::equal($b->get(0), "hello", "get(0) failed");
|
||||
|
||||
check::equal($b->get_first(), "hello world!", "get_first failed");
|
||||
|
||||
check::equal($b->call_get_first(), "hello world!", "call_get_first failed");
|
||||
|
||||
$b->call_process_func();
|
||||
|
||||
|
|
|
@ -16,10 +16,14 @@ class B(A):
|
|||
|
||||
b = B("hello")
|
||||
|
||||
b.get(0)
|
||||
if b.get(0) != "hello":
|
||||
raise RuntimeError("b.get(0): {}".format(b.get(0)))
|
||||
|
||||
if b.get_first() != "hello world!":
|
||||
raise RuntimeError("b.get_first(): {}".format(b.get_first()))
|
||||
|
||||
if b.call_get_first() != "hello world!":
|
||||
raise RuntimeError("b.call_get_first(): {}".format(b.call_get_first()))
|
||||
|
||||
b.call_process_func()
|
||||
|
||||
|
|
|
@ -12,13 +12,28 @@ require 'swig_assert'
|
|||
require 'director_string'
|
||||
|
||||
class B < Director_string::A
|
||||
attr_accessor :smem
|
||||
|
||||
def initialize(some_string)
|
||||
super(some_string)
|
||||
end
|
||||
|
||||
def get_first()
|
||||
return super() + " world!"
|
||||
end
|
||||
|
||||
def process_text(string)
|
||||
super(string)
|
||||
@smem = "hello"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
b = B.new("hello")
|
||||
b.get_first
|
||||
b.get(0)
|
||||
raise RuntimeError if b.get(0) != "hello"
|
||||
raise RuntimeError if b.get_first() != "hello world!"
|
||||
raise RuntimeError if b.call_get_first() != "hello world!"
|
||||
|
||||
b.call_process_func()
|
||||
raise RuntimeError if b.smem != "hello"
|
||||
|
|
Loading…
Reference in New Issue