From 0dd5ea3c1492b15bd386ec5c2c8d6e467a8f72a9 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 14 Jan 2015 13:30:43 +0100 Subject: link overriding functions to the corresponding base class functions --- test/data/classes/indirectOverride.kt | 9 +++++++++ test/data/format/overridingFunction.kt | 7 +++++++ test/data/format/overridingFunction.md | 13 +++++++++++++ test/src/format/MarkdownFormatTest.kt | 8 ++++++++ test/src/model/ClassTest.kt | 16 ++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 test/data/classes/indirectOverride.kt create mode 100644 test/data/format/overridingFunction.kt create mode 100644 test/data/format/overridingFunction.md (limited to 'test') diff --git a/test/data/classes/indirectOverride.kt b/test/data/classes/indirectOverride.kt new file mode 100644 index 00000000..8d091b80 --- /dev/null +++ b/test/data/classes/indirectOverride.kt @@ -0,0 +1,9 @@ +abstract class C() { + abstract fun foo() +} + +abstract class D(): C() + +class E(): D() { + override fun foo() {} +} diff --git a/test/data/format/overridingFunction.kt b/test/data/format/overridingFunction.kt new file mode 100644 index 00000000..d7329489 --- /dev/null +++ b/test/data/format/overridingFunction.kt @@ -0,0 +1,7 @@ +open class C() { + open fun f() {} +} + +class D(): C() { + override fun f() {} +} diff --git a/test/data/format/overridingFunction.md b/test/data/format/overridingFunction.md new file mode 100644 index 00000000..b53b3e13 --- /dev/null +++ b/test/data/format/overridingFunction.md @@ -0,0 +1,13 @@ +[test](out.md) / [](out.md) / [D](out.md) / [f](out.md) + + +# f + + +``` +fun f(): Unit +``` + +Overrides [C.f](out.md) + + diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt index f7fc6da0..580acd7c 100644 --- a/test/src/format/MarkdownFormatTest.kt +++ b/test/src/format/MarkdownFormatTest.kt @@ -61,4 +61,12 @@ public class MarkdownFormatTest { markdownService.appendNodes(tempLocation, output, model.members.single().members) } } + + Test fun overridingFunction() { + verifyOutput("test/data/format/overridingFunction.kt", ".md") { model, output -> + val classMembers = model.members.single().members.first { it.name == "D" }.members + markdownService.appendNodes(tempLocation, output, classMembers.filter { it.name == "f" }) + } + + } } diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index 61bc68bd..5b9e1b1a 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -229,6 +229,22 @@ public class ClassTest { val modifiers = details(DocumentationNode.Kind.Modifier) assertEquals(2, modifiers.size()) assertEquals("final", modifiers[1].name) + + val overrideReferences = references(DocumentationReference.Kind.Override) + assertEquals(1, overrideReferences.size()) + } + } + } + + Test fun indirectOverride() { + verifyModel("test/data/classes/indirectOverride.kt") { model -> + with(model.members.single().members.first { it.name == "E"}.members.first { it.name == "foo" }) { + val modifiers = details(DocumentationNode.Kind.Modifier) + assertEquals(2, modifiers.size()) + assertEquals("final", modifiers[1].name) + + val overrideReferences = references(DocumentationReference.Kind.Override) + assertEquals(1, overrideReferences.size()) } } } -- cgit