WhiteBread v4.5.0 WhiteBread.Context.StepFunction

Link to this section Summary

Functions

Indicates if the step function matches the given string. String step functions match if the whole string matches. Regex steps pass the call to Regex.match?

Link to this section Functions

Link to this function call(step_function, step, state)
Link to this function match?(data, string)

Indicates if the step function matches the given string. String step functions match if the whole string matches. Regex steps pass the call to Regex.match?

Example - String step functions

iex> step_function = StepFunction.new("hello midgard", fn -> :hooray end)
iex> StepFunction.match?(step_function, "hello midgard")
true

iex> step_function = StepFunction.new("hello asgard", fn -> :hooray end)
iex> StepFunction.match?(step_function, "hello midgard")
false

Example - Regex step functions

iex> step_function = StepFunction.new(~r/^hello (.+)$/, fn -> :hooray end)
iex> StepFunction.match?(step_function, "hello midgard")
true

iex> step_function = StepFunction.new(~r/^hello ([a-z]+)$/, fn -> :hooray end)
iex> StepFunction.match?(step_function, "hello midgard 9")
false
Link to this function new(regex, func)
Link to this function type(step_function)