aboutsummaryrefslogtreecommitdiff
path: root/smali-integration-tests
diff options
context:
space:
mode:
authorJesusFreke@JesusFreke.com <JesusFreke@JesusFreke.com@55b6fa8a-2a1e-11de-a435-ffa8d773f76a>2009-06-19 03:14:06 +0000
committerJesusFreke@JesusFreke.com <JesusFreke@JesusFreke.com@55b6fa8a-2a1e-11de-a435-ffa8d773f76a>2009-06-19 03:14:06 +0000
commit45b5a1d0e377b575ba2fe6f5e44c3de7991a28bf (patch)
tree4541d213354b1c2fbca4ae567c28019d63fd4f10 /smali-integration-tests
parentdc4bcbe0c07bb9ee85f51402c89a47f1a9b2d059 (diff)
downloadsmali-45b5a1d0e377b575ba2fe6f5e44c3de7991a28bf.tar.gz
Added support for the .catchall directive
git-svn-id: https://smali.googlecode.com/svn/trunk@168 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
Diffstat (limited to 'smali-integration-tests')
-rw-r--r--smali-integration-tests/src/test/smali/junit-tests/ExceptionTest/ExceptionTest.smali80
-rw-r--r--smali-integration-tests/src/test/smali/junit-tests/TestSuite.smali3
2 files changed, 82 insertions, 1 deletions
diff --git a/smali-integration-tests/src/test/smali/junit-tests/ExceptionTest/ExceptionTest.smali b/smali-integration-tests/src/test/smali/junit-tests/ExceptionTest/ExceptionTest.smali
new file mode 100644
index 00000000..e2a3cc30
--- /dev/null
+++ b/smali-integration-tests/src/test/smali/junit-tests/ExceptionTest/ExceptionTest.smali
@@ -0,0 +1,80 @@
+.class public LExceptionTest;
+.super Ljava/lang/Object;
+.source "ExceptionTest.smali"
+
+.method public constructor <init>()V
+ .registers 1
+ invoke-direct {p0}, Ljava/lang/Object;-><init>()V
+ return-void
+.end method
+
+.method public singleCatchTest()V
+ .registers 2
+ .annotation runtime Lorg/junit/Test;
+ .end annotation
+
+ try_start:
+ new-instance v0, Ljava/lang/Exception;
+ const-string v1, "This is an error message"
+ invoke-direct {v0, v1}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
+ throw v0
+ try_end:
+ .catch Ljava/lang/Exception; {try_start: .. try_end:} handler:
+
+ handler:
+ #no need to test anything. If it didn't catch the exception, the test would fail
+ return-void
+.end method
+
+
+.method public nestedCatchTest()V
+ .registers 2
+ .annotation runtime Lorg/junit/Test;
+ .end annotation
+
+ try_start_outer:
+ nop
+ nop
+
+ try_start_inner:
+ new-instance v0, Ljava/lang/RuntimeException;
+ const-string v1, "This is an error message"
+ invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
+ throw v0
+ try_end_inner:
+ .catch Ljava/lang/RuntimeException; {try_start_inner: .. try_end_outer:} handler_inner:
+
+ nop
+ nop
+ try_end_outer:
+
+ .catch Ljava/lang/Exception; {try_start_outer: .. try_end_outer:} handler_outer:
+
+ handler_outer:
+ invoke-static {}, Lorg/junit/Assert;->fail()V
+
+ handler_inner:
+
+
+ return-void
+.end method
+
+
+
+.method public catchAllTest()V
+ .registers 2
+ .annotation runtime Lorg/junit/Test;
+ .end annotation
+
+ try_start:
+ new-instance v0, Ljava/lang/Exception;
+ const-string v1, "This is an error message"
+ invoke-direct {v0, v1}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
+ throw v0
+ try_end:
+ .catchall {try_start: .. try_end:} handler:
+
+ handler:
+ #no need to test anything. If it didn't catch the exception, the test would fail
+ return-void
+.end method \ No newline at end of file
diff --git a/smali-integration-tests/src/test/smali/junit-tests/TestSuite.smali b/smali-integration-tests/src/test/smali/junit-tests/TestSuite.smali
index 5eef5064..bfaf90e1 100644
--- a/smali-integration-tests/src/test/smali/junit-tests/TestSuite.smali
+++ b/smali-integration-tests/src/test/smali/junit-tests/TestSuite.smali
@@ -20,7 +20,8 @@
.end annotation
.annotation runtime Lorg/junit/runners/Suite$SuiteClasses;
- value = { LFieldTest;,
+ value = { LExceptionTest;,
+ LFieldTest;,
LSpecialInstructionPaddingTest;,
LStaticFieldInitializerTest;,
LFormat10x;,