Fix typos and improve grammar in stdlib readmes (#2527)
* Fix typos in the main ReadMe.md * Fix typos in the stdlib samples ReadMe.md Co-Authored-By: ilya-g <ilya.gorbunov@jetbrains.com>
This commit is contained in:
@@ -4,18 +4,18 @@ This module creates the [standard library for Kotlin](https://kotlinlang.org/api
|
||||
|
||||
### Notes for contributors
|
||||
|
||||
We use some code generation to generate the various utility extension function for the various collection-like types like arrays, strings, `Collection<T>`, `Sequence<T>`, `Map<K, V>` etc.
|
||||
We use code generation to generate utility extension functions for some collection-like types like arrays, strings, `Collection<T>`, `Sequence<T>`, `Map<K, V>` etc.
|
||||
|
||||
These sources are placed into `generated` folder and their names are prefixed with the underscore, for example `generated/_Collections.kt`
|
||||
These sources are placed into the `generated` folder and their names are prefixed with an underscore, for example, `generated/_Collections.kt`
|
||||
|
||||
To run the code generator use the following command in the root directory of the project:
|
||||
To run the code generator, use the following command in the root directory of the project:
|
||||
|
||||
./gradlew :tools:kotlin-stdlib-gen:run
|
||||
|
||||
> Note: on Windows type `gradlew` without the leading `./`
|
||||
|
||||
This then runs the script which generates a significant part of stdlib sources from the [templates](../tools/kotlin-stdlib-gen/src/templates) authored with a special kotlin based DSL.
|
||||
This then runs the script which generates a significant part of stdlib sources from the [templates](../tools/kotlin-stdlib-gen/src/templates) written in a special Kotlin-based DSL.
|
||||
|
||||
### Usage samples
|
||||
|
||||
If you want to author samples for the standard library, please head to [the samples readme](samples/ReadMe.md).
|
||||
If you want to author samples for the standard library, please head to [the samples readme](samples/ReadMe.md).
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
This project contains samples for the standard library functions.
|
||||
They are located in the [test](test) source root and each sample is written like a small unit test.
|
||||
Then these samples are referenced in the documentation of the standard library functions
|
||||
with the [`@sample`](https://kotlinlang.org/docs/reference/kotlin-doc.html#block-tags) tag and are embedded in the generated documentation as runnable samples.
|
||||
These samples are referenced in the documentation of the standard library functions
|
||||
with the [`@sample`](https://kotlinlang.org/docs/reference/kotlin-doc.html#block-tags) tag and embedded in the generated documentation as runnable samples.
|
||||
|
||||
|
||||
### Guides for sample authoring
|
||||
|
||||
Note that samples, even though they are written as unit tests, are not conceptually the same as unit tests.
|
||||
Unlike a unit test, which usually explores corner cases of a function being tested,
|
||||
Note that samples, although written as unit tests, are conceptually different from them.
|
||||
While a unit test usually explores corner cases of a function being tested,
|
||||
the goal of a sample is to show a common use case of a function.
|
||||
|
||||
Please see the existing samples for an inspiration on authoring new ones.
|
||||
@@ -26,7 +26,7 @@ in the template, and then all specializations should be regenerated. See [the st
|
||||
depending on the specialization.
|
||||
|
||||
- Each sample should be self contained, but you can introduce local classes and functions in it.
|
||||
Do not use external references, other than the Standard Library itself and JDK.
|
||||
Do not use external references other than the Standard Library itself and JDK.
|
||||
|
||||
- Use only the following subset of assertions:
|
||||
|
||||
@@ -34,7 +34,7 @@ Do not use external references, other than the Standard Library itself and JDK.
|
||||
- `assertTrue`/`assertFalse` to show a boolean value,
|
||||
- `assertFails` / `assertFailsWith` to show that some invocation will fail.
|
||||
|
||||
When a sample is compiled and run during the build these assertions work as usual test assertions.
|
||||
When a sample is compiled and run during the build, these assertions work as usual test assertions.
|
||||
When the sample is transformed to be embedded in docs, these assertions are either replaced with `println` with the comment showing its
|
||||
expected output, or commented out with `//` — this is used for `assertFails` / `assertFailsWith` to prevent execution of its failing block
|
||||
of code.
|
||||
|
||||
Reference in New Issue
Block a user