From 5bccb19933b3eda51518d79ca52a06b89d304bf6 Mon Sep 17 00:00:00 2001 From: eshizhan Date: Fri, 29 Jan 2021 12:34:08 +0800 Subject: add unit tests for LocalVariableAttribute.variableNameByIndex and MethodParametersAttribute.parameterName --- src/test/javassist/JvstTest4.java | 4 ++++ src/test/javassist/bytecode/BytecodeTest.java | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src/test') diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index d53148bd..259451b9 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -1019,11 +1019,15 @@ public class JvstTest4 extends JvstTestRoot { assertEquals(2, attr.size()); assertEquals("i", cp.getUtf8Info(attr.name(0))); assertEquals("s", cp.getUtf8Info(attr.name(1))); + assertEquals("i", attr.parameterName(0)); + assertEquals("s", attr.parameterName(1)); attr = (MethodParametersAttribute)attr.copy(cp, null); assertEquals(2, attr.size()); assertEquals("i", cp.getUtf8Info(attr.name(0))); assertEquals("s", cp.getUtf8Info(attr.name(1))); + assertEquals("i", attr.parameterName(0)); + assertEquals("s", attr.parameterName(1)); } // JIRA JASSIST-220 diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index 5ddf5d5b..7aef1cce 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -354,6 +354,9 @@ public class BytecodeTest extends TestCase { assertEquals("I", ainfo2.descriptor(i)); } print("**** end ***"); + + assertEquals("this", ainfo2.variableNameByIndex(0)); + assertEquals("i", ainfo2.variableNameByIndex(1)); } public void testAnnotations() throws Exception { -- cgit v1.2.3