aboutsummaryrefslogtreecommitdiff
path: root/core/testdata/format/website-samples
diff options
context:
space:
mode:
Diffstat (limited to 'core/testdata/format/website-samples')
-rw-r--r--core/testdata/format/website-samples/dropImport.kt12
-rw-r--r--core/testdata/format/website-samples/dropImport.md23
-rw-r--r--core/testdata/format/website-samples/newLinesInImportList.kt12
-rw-r--r--core/testdata/format/website-samples/newLinesInImportList.md24
-rw-r--r--core/testdata/format/website-samples/newLinesInSamples.kt19
-rw-r--r--core/testdata/format/website-samples/newLinesInSamples.md31
-rw-r--r--core/testdata/format/website-samples/sample.kt16
-rw-r--r--core/testdata/format/website-samples/sample.md39
-rw-r--r--core/testdata/format/website-samples/sampleWithAsserts.kt15
-rw-r--r--core/testdata/format/website-samples/sampleWithAsserts.md24
10 files changed, 215 insertions, 0 deletions
diff --git a/core/testdata/format/website-samples/dropImport.kt b/core/testdata/format/website-samples/dropImport.kt
new file mode 100644
index 000000000..7b8d9f4e8
--- /dev/null
+++ b/core/testdata/format/website-samples/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-samples/dropImport.md b/core/testdata/format/website-samples/dropImport.md
new file mode 100644
index 000000000..1e05678b8
--- /dev/null
+++ b/core/testdata/format/website-samples/dropImport.md
@@ -0,0 +1,23 @@
+---
+title: foo - test
+layout: api
+---
+
+<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div>
+
+# foo
+
+<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" markdown="1">
+
+``` kotlin
+import some.*
+
+fun main(args: Array<String>) {
+//sampleStart
+
+//sampleEnd
+}
+```
+
+</div>
diff --git a/core/testdata/format/website-samples/newLinesInImportList.kt b/core/testdata/format/website-samples/newLinesInImportList.kt
new file mode 100644
index 000000000..836d9f6f0
--- /dev/null
+++ b/core/testdata/format/website-samples/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-samples/newLinesInImportList.md b/core/testdata/format/website-samples/newLinesInImportList.md
new file mode 100644
index 000000000..27d796f80
--- /dev/null
+++ b/core/testdata/format/website-samples/newLinesInImportList.md
@@ -0,0 +1,24 @@
+---
+title: foo - test
+layout: api
+---
+
+<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div>
+
+# foo
+
+<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" markdown="1">
+
+``` kotlin
+import same.*
+import some.*
+
+fun main(args: Array<String>) {
+//sampleStart
+
+//sampleEnd
+}
+```
+
+</div>
diff --git a/core/testdata/format/website-samples/newLinesInSamples.kt b/core/testdata/format/website-samples/newLinesInSamples.kt
new file mode 100644
index 000000000..ee49aefc7
--- /dev/null
+++ b/core/testdata/format/website-samples/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-samples/newLinesInSamples.md b/core/testdata/format/website-samples/newLinesInSamples.md
new file mode 100644
index 000000000..5344b9838
--- /dev/null
+++ b/core/testdata/format/website-samples/newLinesInSamples.md
@@ -0,0 +1,31 @@
+---
+title: foo - test
+layout: api
+---
+
+<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div>
+
+# foo
+
+<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" markdown="1">
+
+``` 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
+}
+```
+
+</div>
diff --git a/core/testdata/format/website-samples/sample.kt b/core/testdata/format/website-samples/sample.kt
new file mode 100644
index 000000000..a664c2f52
--- /dev/null
+++ b/core/testdata/format/website-samples/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-samples/sample.md b/core/testdata/format/website-samples/sample.md
new file mode 100644
index 000000000..b29075a78
--- /dev/null
+++ b/core/testdata/format/website-samples/sample.md
@@ -0,0 +1,39 @@
+---
+title: foo - test
+layout: api
+---
+
+<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div>
+
+# foo
+
+<div class="overload-group" markdown="1">
+
+<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>
+
+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.
+
+<div class="sample" markdown="1">
+
+``` kotlin
+
+
+fun main(args: Array<String>) {
+//sampleStart
+if (true) {
+ println(property)
+}
+//sampleEnd
+}
+```
+
+</div>
+
+</div>
+
+<div class="overload-group" markdown="1">
+
+<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>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div>
+
+</div>
diff --git a/core/testdata/format/website-samples/sampleWithAsserts.kt b/core/testdata/format/website-samples/sampleWithAsserts.kt
new file mode 100644
index 000000000..bb9732d5c
--- /dev/null
+++ b/core/testdata/format/website-samples/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
diff --git a/core/testdata/format/website-samples/sampleWithAsserts.md b/core/testdata/format/website-samples/sampleWithAsserts.md
new file mode 100644
index 000000000..c114468a4
--- /dev/null
+++ b/core/testdata/format/website-samples/sampleWithAsserts.md
@@ -0,0 +1,24 @@
+---
+title: a - test
+layout: api
+---
+
+<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/a">a</a></div>
+
+# 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" markdown="1">
+
+``` kotlin
+
+
+fun main(args: Array<String>) {
+//sampleStart
+println(a()) // Hello, Work
+println("a() == b() is ${a() == b()}") // true
+//sampleEnd
+}
+```
+
+</div>