← ZIO Cli docs

CliAssertion

zio.cli.testkit.CliAssertion
object CliAssertion

CliAssertions contains methods to test a particular CliApp or a particular Command. It's possible to test directly a Command instance

Attributes

Source
CliAssertion.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def accessCommand[R, E, A](cliApp: CliApp[R, E, A], assert: Assertion[Command[_]]): TestResult

Allows to check any assertion on the Command instance employed in a CliApp. Better use only when other methods do not cover your use-case.

Allows to check any assertion on the Command instance employed in a CliApp. Better use only when other methods do not cover your use-case.

Attributes

Source
CliAssertion.scala
def accessHelpDoc[R, E, A](cliApp: CliApp[R, E, A], assert: Assertion[HelpDoc]): TestResult

Attributes

Source
CliAssertion.scala
def accessSynopsis[R, E, A](cliApp: CliApp[R, E, A], assert: Assertion[UsageSynopsis]): TestResult

Attributes

Source
CliAssertion.scala
def assertCliApp[R, E, A, RGen](cliApp: CliApp[R, E, A], pairs: Gen[RGen, CliRepr[List[String], Assertion[Either[CliError[E], A]]]])(implicit cliConfig: CliConfig): ZIO[RGen & R, Throwable, TestResult]

Creates a TestResult from an Assertion over the result of running a command on a CliApp. It can test errors and values produced by the CliApp.

Creates a TestResult from an Assertion over the result of running a command on a CliApp. It can test errors and values produced by the CliApp.

Attributes

Source
CliAssertion.scala
def assertCliAppValues[R, E, A, RGen](cliApp: CliApp[R, E, A], pairs: Gen[RGen, CliRepr[List[String], A]])(implicit cliConfig: CliConfig): ZIO[RGen & R, Throwable, TestResult]

Creates a TestResult to test the output of a CliApp.

Creates a TestResult to test the output of a CliApp.

Attributes

Source
CliAssertion.scala
def assertCliAppZIO[R, E, A, RGen](cliApp: CliApp[R, E, A], pairs: Gen[RGen, CliRepr[List[String], ZIO[R, E, A]]]): ZIO[RGen & R, Throwable, TestResult]

Creates a TestResult to test the output of a CliApp using a ZIO effect.

Creates a TestResult to test the output of a CliApp using a ZIO effect.

Attributes

Source
CliAssertion.scala
def assertCommand[A, R](command: Command[A], pairs: Gen[R, CliRepr[List[String], A]])(implicit cliConfig: CliConfig): ZIO[R, Throwable, TestResult]

Tests the value produced by the Command instance. It fails when there is a ValidationError.

Tests the value produced by the Command instance. It fails when there is a ValidationError.

Attributes

Source
CliAssertion.scala
def assertCommandAll[A, R](command: Command[A], pairs: Gen[R, CliRepr[List[String], Assertion[Either[ValidationError, TestReturn[A]]]]])(implicit cliConfig: CliConfig): ZIO[R, Throwable, TestResult]

Creates a TestResult from an Assertion over the result of parsing a command. It can test ValidationError produced during the parsing process, the value produced by the Command instance and the triggering of built-in options.

Creates a TestResult from an Assertion over the result of parsing a command. It can test ValidationError produced during the parsing process, the value produced by the Command instance and the triggering of built-in options.

Attributes

Source
CliAssertion.scala
def assertCommandSuccess[A, R](command: Command[A], pairs: Gen[R, CliRepr[List[String], Assertion[Either[ValidationError, A]]]])(implicit cliConfig: CliConfig): ZIO[R, Throwable, TestResult]

Creates a TestResult from an Assertion over the result of parsing a command. It can test ValidationError produced during the parsing process and the value produced by the Command instance.

Creates a TestResult from an Assertion over the result of parsing a command. It can test ValidationError produced during the parsing process and the value produced by the Command instance.

Attributes

Source
CliAssertion.scala
def assertHelpDoc[A](command: Command[A], helpDoc: HelpDoc): TestResult

Attributes

Source
CliAssertion.scala
def assertHelpDoc[R, E, A](cliApp: CliApp[R, E, A], helpDoc: HelpDoc): TestResult

Attributes

Source
CliAssertion.scala
def assertSynopsis[A](command: Command[A], synopsis: String)(implicit cliConfig: CliConfig): TestResult

Checks the usage synopsis in String or UsageSynopsis form.

Checks the usage synopsis in String or UsageSynopsis form.

Attributes

Source
CliAssertion.scala
def assertSynopsis[A](command: Command[A], synopsis: List[String])(implicit cliConfig: CliConfig): TestResult

Attributes

Source
CliAssertion.scala
def assertSynopsis[A](command: Command[A], synopsis: UsageSynopsis): TestResult

Attributes

Source
CliAssertion.scala
def assertSynopsis[R, E, A](cliApp: CliApp[R, E, A], synopsis: String)(implicit cliConfig: CliConfig): TestResult

Checks the usage synopsis in String or UsageSynopsis form.

Checks the usage synopsis in String or UsageSynopsis form.

Attributes

Source
CliAssertion.scala
def assertSynopsis[R, E, A](cliApp: CliApp[R, E, A], synopsis: List[String])(implicit cliConfig: CliConfig): TestResult

Attributes

Source
CliAssertion.scala
def assertSynopsis[R, E, A](cliApp: CliApp[R, E, A], synopsis: UsageSynopsis): TestResult

Attributes

Source
CliAssertion.scala
def outputContains[R, E, A, RGen](cliApp: CliApp[R, E, A], pairs: Gen[RGen, CliRepr[List[String], Seq[String]]]): ZIO[RGen & R, Throwable, TestResult]

Checks if the console output of a CliApp contains all the String from a Seq[String].

Checks if the console output of a CliApp contains all the String from a Seq[String].

Attributes

Source
CliAssertion.scala

Implicits

Implicits

implicit val cliConfig: CliConfig

Attributes

Source
CliAssertion.scala