From b54e7744613c17ea7e68608e3783a8c5d5c2dd4b Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sat, 8 Feb 2020 15:03:45 +0800 Subject: [PATCH] feat: add basic extend support --- .../ast/javaast/JavaBasicIdentListenerTest.kt | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaBasicIdentListenerTest.kt b/chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaBasicIdentListenerTest.kt index 17e3c373..46adecc5 100644 --- a/chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaBasicIdentListenerTest.kt +++ b/chapi-ast-java/src/test/kotlin/chapi/ast/javaast/JavaBasicIdentListenerTest.kt @@ -22,7 +22,7 @@ package chapi.ast.javaast; import hello.Expandable; -class IntegerArray implements Expandable { +class IntegerArray implements Expandable { void addItem(Integer item) { } } @@ -30,5 +30,24 @@ class IntegerArray implements Expandable { val codeFile = JavaFullIdent().identBasicInfo(code, "basic") kotlin.test.assertEquals(codeFile.DataStructures.size, 1) kotlin.test.assertEquals(codeFile.DataStructures[0].NodeName, "IntegerArray") + kotlin.test.assertEquals(codeFile.DataStructures[0].Implements[0], "Expandable") + } + + @Test + internal fun shouldIdentifyExtends() { + val code = """ +package chapi.ast.javaast; + +import hello.Expandable; + +class IntegerArray extends Expandable { + void addItem(Integer item) { + } +} +""" + val codeFile = JavaFullIdent().identBasicInfo(code, "basic") + kotlin.test.assertEquals(codeFile.DataStructures.size, 1) + kotlin.test.assertEquals(codeFile.DataStructures[0].NodeName, "IntegerArray") + kotlin.test.assertEquals(codeFile.DataStructures[0].Extend, "Expandable") } }