diff options
Diffstat (limited to 'core/testdata')
23 files changed, 386 insertions, 0 deletions
diff --git a/core/testdata/format/website-html/dataTags/jre7.kt b/core/testdata/format/website-html/dataTags/jre7.kt new file mode 100644 index 00000000..d21b8d7b --- /dev/null +++ b/core/testdata/format/website-html/dataTags/jre7.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jre7New() {} + +fun jre7() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {}
\ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/js.kt b/core/testdata/format/website-html/dataTags/js.kt new file mode 100644 index 00000000..b22d7088 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/js.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jsNew() {} + +fun js() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {}
\ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/jvm.kt b/core/testdata/format/website-html/dataTags/jvm.kt new file mode 100644 index 00000000..02d04226 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/jvm.kt @@ -0,0 +1,11 @@ +package foo + +@SinceKotlin("1.1") +fun jvmNew() {} + +fun jvm() {} + +fun shared() {} + +@SinceKotlin("1.1") +fun sharedNew() {}
\ No newline at end of file diff --git a/core/testdata/format/website-html/dataTags/multiplatform.package.html b/core/testdata/format/website-html/dataTags/multiplatform.package.html new file mode 100644 index 00000000..0430c6f2 --- /dev/null +++ b/core/testdata/format/website-html/dataTags/multiplatform.package.html @@ -0,0 +1,63 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo/index">foo</a></div> +<h2>Package foo</h2> +<h3>Functions</h3> +<table class="api-docs-table"> +<tbody> +<tr data-platform="JVM" data-jre-version="JRE7"><td> +<a href="test/foo/jre7">jre7</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">jre7</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JVM" data-kotlin-version="Kotlin 1.1" data-jre-version="JRE7"><td> +<a href="test/foo/jre7-new">jre7New</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">jre7New</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JS"><td> +<a href="test/foo/js">js</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">js</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JS" data-kotlin-version="Kotlin 1.1"><td> +<a href="test/foo/js-new">jsNew</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">jsNew</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JVM"><td> +<a href="test/foo/jvm">jvm</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">jvm</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JVM" data-kotlin-version="Kotlin 1.1"><td> +<a href="test/foo/jvm-new">jvmNew</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">jvmNew</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JVM, JS" data-jre-version="JRE7"><td> +<a href="test/foo/shared">shared</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">shared</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr><tr data-platform="JVM, JS" data-kotlin-version="Kotlin 1.1" data-jre-version="JRE7"><td> +<a href="test/foo/shared-new">sharedNew</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">sharedNew</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr></tbody> +</table> diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt b/core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/jre7.kt diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/js.kt b/core/testdata/format/website-html/dataTagsInGroupNode/js.kt new file mode 100644 index 00000000..045f3f0d --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/js.kt @@ -0,0 +1,8 @@ +package pack + +class Some { + + fun magic() { + + } +}
\ No newline at end of file diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt b/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt new file mode 100644 index 00000000..57f36742 --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/jvm.kt @@ -0,0 +1,9 @@ +package pack + +class SomeCoolJvmClass { + fun magic() { + + } +} + +typealias Some = SomeCoolJvmClass
\ No newline at end of file diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html new file mode 100644 index 00000000..bca7d36d --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html @@ -0,0 +1,38 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/pack/index">pack</a> / <a href="test/pack/-some/index">Some</a></div> +<h1>Some</h1> +<p><div class="overload-group" data-platform="JVM"><div class="signature"><code><span class="keyword">typealias </span><span class="identifier">Some</span> <span class="symbol">=</span> <span class="identifier">SomeCoolJvmClass</span></code></div> +<p><strong>Platform and version requirements:</strong> JVM</p> +</div> +</p> +<p><div class="overload-group" data-platform="JS"><div class="signature"><code><span class="keyword">class </span><span class="identifier">Some</span></code></div> +<p><strong>Platform and version requirements:</strong> JS</p> +<p>Constructors</p> +<table class="api-docs-table"> +<tbody> +<tr> +<td> +<a href="test/pack/-some/-some/-init-"><init></a> +</td> +<td> +<div class="signature"><code><span class="identifier">Some</span><span class="symbol">(</span><span class="symbol">)</span></code></div> + +</td> +</tr> +</tbody> +</table> +<p>Functions</p> +<table class="api-docs-table"> +<tbody> +<tr> +<td> +<a href="test/pack/-some/-some/magic">magic</a> +</td> +<td> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">magic</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> + +</td> +</tr> +</tbody> +</table> +</div> +</p> diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html new file mode 100644 index 00000000..985f9f04 --- /dev/null +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html @@ -0,0 +1,33 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/pack/index">pack</a></div> +<h2>Package pack</h2> +<h3>Types</h3> +<table class="api-docs-table"> +<tbody> +<tr data-platform="JS"><td> +<a href="test/pack/-some/index">Some</a> +</td> +<td> +<div class="signature"><code><span class="keyword">class </span><span class="identifier">Some</span></code></div> + +</td> +</tr><tr data-platform="JVM"><td> +<a href="test/pack/-some-cool-jvm-class/index">SomeCoolJvmClass</a> +</td> +<td> +<div class="signature"><code><span class="keyword">class </span><span class="identifier">SomeCoolJvmClass</span></code></div> + +</td> +</tr></tbody> +</table> +<h3>Type Aliases</h3> +<table class="api-docs-table"> +<tbody> +<tr data-platform="JVM"><td> +<a href="test/pack/-some/index">Some</a> +</td> +<td> +<div class="signature"><code><span class="keyword">typealias </span><span class="identifier">Some</span> <span class="symbol">=</span> <span class="identifier">SomeCoolJvmClass</span></code></div> + +</td> +</tr></tbody> +</table> diff --git a/core/testdata/format/website-html/dropImport.html b/core/testdata/format/website-html/dropImport.html new file mode 100644 index 00000000..cfcb8cd5 --- /dev/null +++ b/core/testdata/format/website-html/dropImport.html @@ -0,0 +1,11 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div> +<h1>foo</h1> +<a name="$foo()"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> +<div class="sample"><pre><code class="lang-kotlin">import some.* + +fun main(args: Array<String>) { +//sampleStart + +//sampleEnd +}</code></pre></div> diff --git a/core/testdata/format/website-html/dropImport.kt b/core/testdata/format/website-html/dropImport.kt new file mode 100644 index 00000000..7b8d9f4e --- /dev/null +++ b/core/testdata/format/website-html/dropImport.kt @@ -0,0 +1,12 @@ +import samples.* +import some.* + +/** + * @sample example1 + */ +fun foo() { +} + +fun example1() { + +}
\ No newline at end of file diff --git a/core/testdata/format/website-html/newLinesInImportList.html b/core/testdata/format/website-html/newLinesInImportList.html new file mode 100644 index 00000000..4862b314 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInImportList.html @@ -0,0 +1,12 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div> +<h1>foo</h1> +<a name="$foo()"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> +<div class="sample"><pre><code class="lang-kotlin">import same.* +import some.* + +fun main(args: Array<String>) { +//sampleStart + +//sampleEnd +}</code></pre></div> diff --git a/core/testdata/format/website-html/newLinesInImportList.kt b/core/testdata/format/website-html/newLinesInImportList.kt new file mode 100644 index 00000000..836d9f6f --- /dev/null +++ b/core/testdata/format/website-html/newLinesInImportList.kt @@ -0,0 +1,12 @@ +import same.* +import some.* + +/** + * @sample example1 + */ +fun foo() { +} + +fun example1() { + +}
\ No newline at end of file diff --git a/core/testdata/format/website-html/newLinesInSamples.html b/core/testdata/format/website-html/newLinesInSamples.html new file mode 100644 index 00000000..0babe122 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInSamples.html @@ -0,0 +1,19 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div> +<h1>foo</h1> +<a name="$foo()"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></div> +<div class="sample"><pre><code class="lang-kotlin"> + +fun main(args: Array<String>) { +//sampleStart +val words = listOf("a", "abc", "ab", "def", "abcd") +val byLength = words.groupBy { it.length } + +println(byLength.keys) // [1, 3, 2, 4] +println(byLength.values) // [[a], [abc, def], [ab], [abcd]] + +val mutableByLength: MutableMap<Int, MutableList<String>> = words.groupByTo(mutableMapOf()) { it.length } +// same content as in byLength map, but the map is mutable +println("mutableByLength == byLength is ${mutableByLength == byLength}") // true +//sampleEnd +}</code></pre></div> diff --git a/core/testdata/format/website-html/newLinesInSamples.kt b/core/testdata/format/website-html/newLinesInSamples.kt new file mode 100644 index 00000000..ee49aefc --- /dev/null +++ b/core/testdata/format/website-html/newLinesInSamples.kt @@ -0,0 +1,19 @@ +fun groupBySample() { + val words = listOf("a", "abc", "ab", "def", "abcd") + val byLength = words.groupBy { it.length } + + assertPrints(byLength.keys, "[1, 3, 2, 4]") + assertPrints(byLength.values, "[[a], [abc, def], [ab], [abcd]]") + + val mutableByLength: MutableMap<Int, MutableList<String>> = words.groupByTo(mutableMapOf()) { it.length } + // same content as in byLength map, but the map is mutable + assertTrue(mutableByLength == byLength) +} + + +/** + * @sample groupBySample + */ +fun foo() { + +}
\ No newline at end of file diff --git a/core/testdata/format/website-html/overloadGroup.html b/core/testdata/format/website-html/overloadGroup.html new file mode 100644 index 00000000..2482f8fb --- /dev/null +++ b/core/testdata/format/website-html/overloadGroup.html @@ -0,0 +1,18 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/magic">magic</a></div> +<h1>magic</h1> +<p><div class="overload-group"><a name="$magic(kotlin.String)"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">magic</span><span class="symbol">(</span><span class="parameterName" id="$magic(kotlin.String)/spell">spell</span><span class="symbol">:</span> <span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div> +<p>Parameters</p> +<p><a name="spell"></a> +<code>spell</code> - The text of spell, often distributed on scrolls</p> +<p><strong>Return</strong>Spell ID for future casts</p> +</div> +</p> +<p><div class="overload-group"><a name="$magic(kotlin.Int)"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">magic</span><span class="symbol">(</span><span class="parameterName" id="$magic(kotlin.Int)/spell">spell</span><span class="symbol">:</span> <span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div> +<p>Parameters</p> +<p><a name="spell"></a> +<code>spell</code> - Spell ID of previously casted spell</p> +<p><strong>Return</strong>Spell ID for future casts</p> +</div> +</p> diff --git a/core/testdata/format/website-html/overloadGroup.kt b/core/testdata/format/website-html/overloadGroup.kt new file mode 100644 index 00000000..5bc98e3d --- /dev/null +++ b/core/testdata/format/website-html/overloadGroup.kt @@ -0,0 +1,15 @@ +/** + * @param spell The text of spell, often distributed on scrolls + * @return Spell ID for future casts + */ +fun magic(spell: String): Int { + +} + +/** + * @param spell Spell ID of previously casted spell + * @return Spell ID for future casts + */ +fun magic(spell: Int): Int { + +}
\ No newline at end of file diff --git a/core/testdata/format/website-html/returnTag.html b/core/testdata/format/website-html/returnTag.html new file mode 100644 index 00000000..92253130 --- /dev/null +++ b/core/testdata/format/website-html/returnTag.html @@ -0,0 +1,9 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/index-of">indexOf</a></div> +<h1>indexOf</h1> +<a name="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)"></a> +<div class="signature"><code><span class="keyword">fun </span><a href="test/-foo/index"><span class="identifier">Foo</span></a><span class="symbol">.</span><span class="identifier">indexOf</span><span class="symbol">(</span><br/> <span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/char">char</span><span class="symbol">:</span> <span class="identifier">Char</span><span class="symbol">, </span><br/> <span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/startIndex">startIndex</span><span class="symbol">:</span> <span class="identifier">Int</span> <span class="symbol">=</span> 0<span class="symbol">, </span><br/> <span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/ignoreCase">ignoreCase</span><span class="symbol">:</span> <span class="identifier">Boolean</span> <span class="symbol">=</span> false<br/><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div> +<p>Returns the index within this string of the first occurrence of the specified character, starting from the specified <a href="test/index-of#$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/startIndex">startIndex</a>.</p> +<h3>Parameters</h3> +<p><a name="ignoreCase"></a> +<code>ignoreCase</code> - <code>true</code> to ignore character case when matching a character. By default <code>false</code>.</p> +<p><strong>Returns</strong>An index of the first occurrence of <a href="test/index-of#$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/char">char</a> or -1 if none is found.</p> diff --git a/core/testdata/format/website-html/returnTag.kt b/core/testdata/format/website-html/returnTag.kt new file mode 100644 index 00000000..669c14f9 --- /dev/null +++ b/core/testdata/format/website-html/returnTag.kt @@ -0,0 +1,11 @@ +class Foo + +/** + * Returns the index within this string of the first occurrence of the specified character, starting from the specified [startIndex]. + * + * @param ignoreCase `true` to ignore character case when matching a character. By default `false`. + * @returns An index of the first occurrence of [char] or -1 if none is found. + */ +fun Foo.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int { + return -1 +} diff --git a/core/testdata/format/website-html/sample.html b/core/testdata/format/website-html/sample.html new file mode 100644 index 00000000..00646a11 --- /dev/null +++ b/core/testdata/format/website-html/sample.html @@ -0,0 +1,21 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div> +<h1>foo</h1> +<p><div class="overload-group"><a name="$foo()"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div> +<p>Groups elements of the original sequence by the key returned by the given <a href="#">keySelector</a> function +applied to each element and returns a map where each group key is associated with a list of corresponding elements.</p> +<div class="sample"><pre><code class="lang-kotlin"> + +fun main(args: Array<String>) { +//sampleStart +if (true) { + println(property) +} +//sampleEnd +}</code></pre></div> +</div> +</p> +<p><div class="overload-group"><a name="$foo(kotlin.Int)"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="parameterName" id="$foo(kotlin.Int)/i">i</span><span class="symbol">:</span> <span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div> +</div> +</p> diff --git a/core/testdata/format/website-html/sample.kt b/core/testdata/format/website-html/sample.kt new file mode 100644 index 00000000..a664c2f5 --- /dev/null +++ b/core/testdata/format/website-html/sample.kt @@ -0,0 +1,16 @@ +/** + * Groups elements of the original sequence by the key returned by the given [keySelector] function + * applied to each element and returns a map where each group key is associated with a list of corresponding elements. + * @sample example1 + */ +fun foo(): Int { + return 0 +} + +fun foo(i: Int): Int { + return 1 +} + +fun example1(node: String) = if (true) { + println(property) +} diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html new file mode 100644 index 00000000..012f91ab --- /dev/null +++ b/core/testdata/format/website-html/sampleWithAsserts.html @@ -0,0 +1,12 @@ +<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/a">a</a></div> +<h1>a</h1> +<a name="$a()"></a> +<div class="signature"><code><span class="keyword">fun </span><span class="identifier">a</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">String</span></code></div> +<div class="sample"><pre><code class="lang-kotlin"> + +fun main(args: Array<String>) { +//sampleStart +println(a()) // Hello, Work +println("a() == b() is ${a() == b()}") // true +//sampleEnd +}</code></pre></div> diff --git a/core/testdata/format/website-html/sampleWithAsserts.kt b/core/testdata/format/website-html/sampleWithAsserts.kt new file mode 100644 index 00000000..bb9732d5 --- /dev/null +++ b/core/testdata/format/website-html/sampleWithAsserts.kt @@ -0,0 +1,15 @@ +/** + * @sample sample + */ +fun a(): String { + return "Hello, Work" +} + +fun b(): String { + return "Hello, Rest" +} + +fun sample() { + assertPrints(a(), "Hello, Work") + assertTrue(a() == b()) +}
\ No newline at end of file |