diff options
author | akuznetsov <akuznetsov@tradingview.com> | 2023-12-29 17:29:28 +0400 |
---|---|---|
committer | akuznetsov <akuznetsov@tradingview.com> | 2023-12-29 17:29:28 +0400 |
commit | 9777bae93cc84249fe08a7e81b2101c415bd55e5 (patch) | |
tree | 64fb183df9171cf231e3429fa6248706d2af9105 /src/test | |
parent | 0824a7a04e2f5ca8acc355c2379cf625dadc8943 (diff) | |
download | javassist-9777bae93cc84249fe08a7e81b2101c415bd55e5.tar.gz javassist-9777bae93cc84249fe08a7e81b2101c415bd55e5.zip |
line numbers for undefined ids & more
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/javassist/LineNumberTest.java | 14 | ||||
-rw-r--r-- | src/test/javassist/compiler/CompTest.java | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/test/javassist/LineNumberTest.java b/src/test/javassist/LineNumberTest.java index 158efd01..7e9fbd2f 100644 --- a/src/test/javassist/LineNumberTest.java +++ b/src/test/javassist/LineNumberTest.java @@ -13,6 +13,20 @@ public class LineNumberTest extends TestCase { "}"), "line 3: syntax error near \" return\n}\""); } + public void testUndevField() { + doTestCompile(String.join("\n", + "public void run() {", + " foo = 5;", + "}"), "line 2: no such field: foo"); + } + + public void testUndevMethod() { + doTestCompile(String.join("\n", + "public void run() {", + " foo();", + "}"), "line 2: foo() not found in javassist.LineNumberCompileTest2"); + } + public void testException() { doTestRuntime(String.join("\n", "public void run() {", diff --git a/src/test/javassist/compiler/CompTest.java b/src/test/javassist/compiler/CompTest.java index 4154935f..5774f7aa 100644 --- a/src/test/javassist/compiler/CompTest.java +++ b/src/test/javassist/compiler/CompTest.java @@ -105,11 +105,11 @@ public class CompTest extends TestCase { public void testArgTypesToString() { String s; - s = TypeChecker.argTypesToString(new int[0], new int[0], new String[0]); + s = TypeChecker.argTypesToString(new int[0], new int[0], new String[0], 0); assertEquals("()", s); s = TypeChecker.argTypesToString(new int[] { TokenId.INT, TokenId.CHAR, TokenId.CLASS }, new int[] { 0, 1, 0 }, - new String[] { null, null, "String" }); + new String[] { null, null, "String" }, 0); assertEquals("(int,char[],String)", s); } |