mirror of
https://github.com/hexedtech/jni-toolbox.git
synced 2024-11-24 16:34:52 +01:00
test: passing env and JString
This commit is contained in:
parent
1389f71c97
commit
a3918afaaf
2 changed files with 11 additions and 0 deletions
|
@ -14,6 +14,7 @@ public class Main {
|
|||
static native String concat(String a, String b);
|
||||
static native String[] to_vec(String a, String b, String c);
|
||||
static native boolean maybe(String optional);
|
||||
static native String raw();
|
||||
|
||||
@Test
|
||||
public void argumentsByValue() {
|
||||
|
@ -47,5 +48,10 @@ public class Main {
|
|||
assertEquals(Main.maybe(null), false);
|
||||
assertEquals(Main.maybe("aa"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void passEnv() {
|
||||
assertEquals(Main.raw(), "hello world!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,3 +19,8 @@ fn to_vec(a: String, b: String, c: String) -> Vec<String> {
|
|||
fn maybe(idk: Option<String>) -> bool {
|
||||
idk.is_some()
|
||||
}
|
||||
|
||||
#[jni(package = "toolbox", class = "Main")]
|
||||
fn raw<'local>(env: &mut jni::JNIEnv<'local>) -> Result<jni::objects::JString<'local>, jni::errors::Error> {
|
||||
env.new_string("hello world!")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue