Skip to content

Commit

Permalink
Add samples for pathExpectations of api-infix (#999) (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhushikesh authored Oct 12, 2021
1 parent 1d8ffce commit f766284
Show file tree
Hide file tree
Showing 3 changed files with 500 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ infix fun <T : Path> Expect<T>.endsNotWith(expected: Path): Expect<T> =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toExist
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") existing: existing): Expect<T> =
Expand All @@ -89,6 +91,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") existing: exis
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.notToExist
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.notToBe(@Suppress("UNUSED_PARAMETER") existing: existing): Expect<T> =
Expand All @@ -102,6 +106,8 @@ infix fun <T : Path> Expect<T>.notToBe(@Suppress("UNUSED_PARAMETER") existing: e
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.extensionFeature
*
* @since 0.12.0
*/
val <T : Path> Expect<T>.extension: Expect<String>
Expand All @@ -116,6 +122,8 @@ val <T : Path> Expect<T>.extension: Expect<String>
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.extension
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.extension(assertionCreator: Expect<String>.() -> Unit): Expect<T> =
Expand All @@ -129,6 +137,8 @@ infix fun <T : Path> Expect<T>.extension(assertionCreator: Expect<String>.() ->
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.fileNameFeature
*
* @since 0.12.0
*/
val <T : Path> Expect<T>.fileName: Expect<String>
Expand All @@ -143,6 +153,8 @@ val <T : Path> Expect<T>.fileName: Expect<String>
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.fileName
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.fileName(assertionCreator: Expect<String>.() -> Unit): Expect<T> =
Expand All @@ -156,6 +168,8 @@ infix fun <T : Path> Expect<T>.fileName(assertionCreator: Expect<String>.() -> U
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.fileNameWithoutExtension
*
* @since 0.12.0
*/
val <T : Path> Expect<T>.fileNameWithoutExtension: Expect<String>
Expand All @@ -182,6 +196,8 @@ infix fun <T : Path> Expect<T>.fileNameWithoutExtension(assertionCreator: Expect
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.parentFeature
*
* @since 0.12.0
*/
val <T : Path> Expect<T>.parent: Expect<Path>
Expand All @@ -194,6 +210,8 @@ val <T : Path> Expect<T>.parent: Expect<Path>
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.parent
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.parent(assertionCreator: Expect<Path>.() -> Unit): Expect<T> =
Expand All @@ -206,6 +224,8 @@ infix fun <T : Path> Expect<T>.parent(assertionCreator: Expect<Path>.() -> Unit)
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.resolveFeature
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.resolve(other: String): Expect<Path> =
Expand All @@ -221,6 +241,8 @@ infix fun <T : Path> Expect<T>.resolve(other: String): Expect<Path> =
*
* @return The newly created [Expect] for the extracted feature.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.resolve
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.resolve(path: PathWithCreator<Path>): Expect<T> =
Expand Down Expand Up @@ -249,6 +271,8 @@ fun <E> path(path: String, assertionCreator: Expect<E>.() -> Unit): PathWithCrea
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeReadable
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") readable: readable): Expect<T> =
Expand All @@ -266,6 +290,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") readable: read
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeWritable
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") writable: writable): Expect<T> =
Expand All @@ -287,6 +313,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") writable: writ
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeExecutable
*
* @since 0.14.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") executable: executable): Expect<T> =
Expand All @@ -307,6 +335,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") executable: ex
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeARegularFile
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") aRegularFile: aRegularFile): Expect<T> =
Expand All @@ -327,6 +357,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") aRegularFile:
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeADirectory
*
* @since 0.12.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") aDirectory: aDirectory): Expect<T> =
Expand All @@ -343,7 +375,7 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") aDirectory: aD
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.PathAssertionSamples.toBeASymbolicLink
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeASymbolicLink
*
* @since 0.16.0
*/
Expand All @@ -357,6 +389,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") aSymbolicLink:
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeAbsolute
*
* @since 0.14.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") absolute: absolute): Expect<T> =
Expand All @@ -369,6 +403,8 @@ infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") absolute: abso
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeRelative
*
* @since 0.14.0
*/
infix fun <T : Path> Expect<T>.toBe(@Suppress("UNUSED_PARAMETER") relative: relative): Expect<T> =
Expand Down Expand Up @@ -446,7 +482,7 @@ fun directoryEntries(entry: String, vararg otherEntries: String) = DirectoryEntr
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.PathAssertionSamples.toBeAnEmptyDirectory
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toBeAnEmptyDirectory
*
* @since 0.16.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import java.nio.file.Path
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toStartWith
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.toStartWith(expected: Path): Expect<T> =
Expand All @@ -26,6 +28,8 @@ infix fun <T : Path> Expect<T>.toStartWith(expected: Path): Expect<T> =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.notToStartWith
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.notToStartWith(expected: Path): Expect<T> =
Expand All @@ -36,6 +40,8 @@ infix fun <T : Path> Expect<T>.notToStartWith(expected: Path): Expect<T> =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toEndWith
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.toEndWith(expected: Path): Expect<T> =
Expand All @@ -47,6 +53,8 @@ infix fun <T : Path> Expect<T>.toEndWith(expected: Path): Expect<T> =
* @param expected The [Path] provided to the assertion
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.notToEndWith
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.notToEndWith(expected: Path): Expect<T> =
Expand All @@ -70,6 +78,8 @@ infix fun <T : Path> Expect<T>.notToEndWith(expected: Path): Expect<T> =
* @see [directoryEntries]
* @see [hasDirectoryEntry]
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toHaveTheDirectoryEntries
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.toHave(directoryEntries: DirectoryEntries) =
Expand All @@ -81,6 +91,8 @@ infix fun <T : Path> Expect<T>.toHave(directoryEntries: DirectoryEntries) =
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toHaveTheSameTextualContentAs
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.toHaveTheSameTextualContentAs(
Expand All @@ -95,7 +107,9 @@ infix fun <T : Path> Expect<T>.toHaveTheSameTextualContentAs(
*
* @return an [Expect] for the subject of `this` expectation.
*
* @since 0.17.0
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toHaveTheSameTextualContentAsPathWithEncoding
*
@since 0.17.0
*/
infix fun <T : Path> Expect<T>.toHaveTheSameTextualContentAs(pathWithEncoding: PathWithEncoding): Expect<T> =
_logicAppend {
Expand All @@ -108,6 +122,8 @@ infix fun <T : Path> Expect<T>.toHaveTheSameTextualContentAs(pathWithEncoding: P
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.PathExpectationSamples.toHaveTheSameBinaryContentAs
*
* @since 0.17.0
*/
infix fun <T : Path> Expect<T>.toHaveTheSameBinaryContentAs(targetPath: Path): Expect<T> =
Expand Down
Loading

0 comments on commit f766284

Please sign in to comment.