Be more specific when we exit because of an unimplemented JNI call.
Also add basic char/string escaping functions for cleaning error messages.
Change-Id: I03df28e30a492bfd293ef6aa56a703ec87817ed5
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index bc3ddcc..a7f6917 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -8,17 +8,25 @@
namespace art {
class JniInternalTest : public RuntimeTest {
+ protected:
+ virtual void SetUp() {
+ RuntimeTest::SetUp();
+ env_ = Thread::Current()->GetJniEnv();
+ }
+ JNIEnv* env_;
};
+TEST_F(JniInternalTest, GetVersion) {
+ ASSERT_EQ(JNI_VERSION_1_6, env_->GetVersion());
+}
+
#define EXPECT_CLASS_FOUND(NAME) \
- EXPECT_TRUE(env->FindClass(NAME) != NULL)
+ EXPECT_TRUE(env_->FindClass(NAME) != NULL)
#define EXPECT_CLASS_NOT_FOUND(NAME) \
- EXPECT_TRUE(env->FindClass(NAME) == NULL)
+ EXPECT_TRUE(env_->FindClass(NAME) == NULL)
TEST_F(JniInternalTest, FindClass) {
- JNIEnv* env = Thread::Current()->GetJniEnv();
-
// TODO: when these tests start failing because you're calling FindClass
// with a pending exception, fix EXPECT_CLASS_NOT_FOUND to assert that an
// exception was thrown and clear the exception.