test multiple calls for const string& return values

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9520 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-11-03 21:55:24 +00:00
commit 3883cb262d

View file

@ -14,16 +14,21 @@ public class director_string_runme {
public static void main(String argv[]) {
director_string_B b = new director_string_B("hello");
String s;
director_string_A c = new director_string_A("hi");
for (int i=0; i<3; i++) {
s = c.call_get(i);
if (!s.equals(new Integer(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s);
}
director_string_B b = new director_string_B("hello");
s = b.call_get_first();
if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed");
s = b.call_get(0);
if (!s.equals("director_string_B.get")) throw new RuntimeException("get(0) failed");
// if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed");
if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed");
}
}
@ -36,9 +41,16 @@ class director_string_B extends A {
}
public String get(int n) {
return "director_string_B.get";
// recursive call problem (needs fixing)
// return "director_string_B.get: " + super.get(n);
return "director_string_B.get: " + super.get(n);
}
}
class director_string_A extends A {
public director_string_A(String first) {
super(first);
}
public String get(int n) {
return new Integer(n).toString();
}
}