Current section
Files
Jump to
Current section
Files
src/given@internal@usage_examples.erl
-module(given@internal@usage_examples).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([given_that_example/0, given_not_example/0, given_any_example/0, given_all_example/0, given_not_any_example/0, given_not_all_example/0, given_when_example/0, given_when_not_example/0, given_empty_example/0, given_non_empty_example/0, given_ok_example/0, given_any_ok_example/0, given_all_ok_example/0, given_error_example/0, given_any_error_example/0, given_all_error_example/0, given_some_example/0, given_any_some_example/0, given_all_some_example/0, given_none_example/0, given_any_none_example/0, given_all_none_example/0, main/0]).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 3).
-spec given_that_example() -> binary().
given_that_example() ->
User_understood = true,
given:that(
User_understood,
fun() -> <<"💡 Bright!"/utf8>> end,
fun() -> <<"🤯 Woof!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 11).
-spec given_not_example() -> binary().
given_not_example() ->
Has_admin_role = true,
given:'not'(
Has_admin_role,
fun() -> <<"✋ Denied!"/utf8>> end,
fun() -> <<"👌 Access granted..."/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 20).
-spec given_any_example() -> binary().
given_any_example() ->
Is_admin = false,
Is_editor = true,
given:any(
[Is_admin, Is_editor],
fun() -> <<"At least admin or editor"/utf8>> end,
fun() -> <<"Got nothing to say 🤷♂️"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 32).
-spec given_all_example() -> binary().
given_all_example() ->
Is_active = true,
Is_confirmed = false,
given:all(
[Is_active, Is_confirmed],
fun() -> <<"Ready, steady, go!"/utf8>> end,
fun() -> <<"Not both active and confirmed"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 44).
-spec given_not_any_example() -> binary().
given_not_any_example() ->
Is_admin = false,
Is_editor = true,
given:not_any(
[Is_admin, Is_editor],
fun() -> <<"At least either Admin or Editor!"/utf8>> end,
fun() -> <<"User has no special role!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 56).
-spec given_not_all_example() -> binary().
given_not_all_example() ->
Is_human = false,
Is_robot = false,
given:not_all(
[Is_human, Is_robot],
fun() -> <<"Obsolete model detected."/utf8>> end,
fun() -> <<"I am a Cylon!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 68).
-spec given_when_example() -> binary().
given_when_example() ->
Enabled = fun() -> true end,
given:'when'(
Enabled,
fun() -> <<"Not an Admin"/utf8>> end,
fun() -> <<"Indeed an Admin"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 77).
-spec given_when_not_example() -> binary().
given_when_not_example() ->
Enabled = fun() -> false end,
given:when_not(
Enabled,
fun() -> <<"Indeed an Admin"/utf8>> end,
fun() -> <<"Not an Admin"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 86).
-spec given_empty_example() -> binary().
given_empty_example() ->
List = [],
given:empty(
List,
fun() -> <<"Non-empty!"/utf8>> end,
fun() -> <<"Empty!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 95).
-spec given_non_empty_example() -> binary().
given_non_empty_example() ->
List = [1],
given:non_empty(
List,
fun() -> <<"Empty!"/utf8>> end,
fun() -> <<"Non-empty!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 104).
-spec given_ok_example() -> binary().
given_ok_example() ->
A_result = {ok, <<"Hello Joe, again!"/utf8>>},
given:ok(
A_result,
fun(_) -> <<"Error value"/utf8>> end,
fun(Ok_value) -> Ok_value end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 114).
-spec given_any_ok_example() -> binary().
given_any_ok_example() ->
Results = [{ok, <<"Great"/utf8>>}, {error, <<"Bad"/utf8>>}],
given:any_ok(
Results,
fun(_) -> <<"All Errors"/utf8>> end,
fun(_, _) -> <<"At least some OKs"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 125).
-spec given_all_ok_example() -> binary().
given_all_ok_example() ->
Results = [{ok, <<"Great"/utf8>>}, {error, <<"Bad"/utf8>>}],
given:all_ok(
Results,
fun(_, _) -> <<"Some Errors"/utf8>> end,
fun(_) -> <<"All OKs"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 136).
-spec given_error_example() -> binary().
given_error_example() ->
A_result = {error, <<"Memory exhausted, again!"/utf8>>},
given:error(
A_result,
fun(_) -> <<"Ok value"/utf8>> end,
fun(Error_value) -> Error_value end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 146).
-spec given_any_error_example() -> binary().
given_any_error_example() ->
Results = [{ok, <<"Good"/utf8>>}, {error, <<"Bad"/utf8>>}],
given:any_error(
Results,
fun(_) -> <<"Bad"/utf8>> end,
fun(_, _) -> <<"Good"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 157).
-spec given_all_error_example() -> binary().
given_all_error_example() ->
begin
Results = [{ok, <<"Nice"/utf8>>}, {error, <<"Meh"/utf8>>}],
given:all_error(
Results,
fun(_, _) -> <<"Meh"/utf8>> end,
fun(_) -> <<"Nice"/utf8>> end
)
end.
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 172).
-spec given_some_example() -> binary().
given_some_example() ->
An_option = {some, <<"One More Penny"/utf8>>},
given:some(
An_option,
fun() -> <<"Woof!"/utf8>> end,
fun(Some_value) -> Some_value end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 180).
-spec given_any_some_example() -> binary().
given_any_some_example() ->
Options = [{some, <<"One"/utf8>>}, none],
given:any_some(
Options,
fun(_) -> <<"Just rocks here, move on..."/utf8>> end,
fun(_, _) -> <<"We found some Gold!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 192).
-spec given_all_some_example() -> binary().
given_all_some_example() ->
Options = [{some, <<"One"/utf8>>}, none],
given:all_some(
Options,
fun(_, _) -> <<"Nothing found..."/utf8>> end,
fun(_) -> <<"There is Gold everywhere!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 204).
-spec given_none_example() -> binary().
given_none_example() ->
An_option = none,
given:none(
An_option,
fun(_) -> <<"Some value"/utf8>> end,
fun() -> <<"None, e.g. Still nothing!"/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 212).
-spec given_any_none_example() -> binary().
given_any_none_example() ->
Options = [{some, <<"One"/utf8>>}, none],
given:any_none(
Options,
fun(_) -> <<"Only Nones Here!"/utf8>> end,
fun(_, _) -> <<"The system detected Some-things."/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 224).
-spec given_all_none_example() -> binary().
given_all_none_example() ->
Options = [{some, <<"One"/utf8>>}, none],
given:all_none(
Options,
fun(_, _) -> <<"There is something out there..."/utf8>> end,
fun() -> <<"There is nothing out there..."/utf8>> end
).
-file("/Volumes/Gleam/gleam-given/src/given/internal/usage_examples.gleam", 237).
-spec main() -> binary().
main() ->
_pipe = given_that_example(),
gleam@io:debug(_pipe),
_pipe@1 = given_any_example(),
gleam@io:debug(_pipe@1),
_pipe@2 = given_all_example(),
gleam@io:debug(_pipe@2),
_pipe@3 = given_not_example(),
gleam@io:debug(_pipe@3),
_pipe@4 = given_not_any_example(),
gleam@io:debug(_pipe@4),
_pipe@5 = given_not_all_example(),
gleam@io:debug(_pipe@5),
_pipe@6 = given_when_example(),
gleam@io:debug(_pipe@6),
_pipe@7 = given_when_not_example(),
gleam@io:debug(_pipe@7),
_pipe@8 = given_empty_example(),
gleam@io:debug(_pipe@8),
_pipe@9 = given_non_empty_example(),
gleam@io:debug(_pipe@9),
_pipe@10 = given_ok_example(),
gleam@io:debug(_pipe@10),
_pipe@11 = given_any_ok_example(),
gleam@io:debug(_pipe@11),
_pipe@12 = given_all_ok_example(),
gleam@io:debug(_pipe@12),
_pipe@13 = given_error_example(),
gleam@io:debug(_pipe@13),
_pipe@14 = given_any_error_example(),
gleam@io:debug(_pipe@14),
_pipe@15 = given_all_error_example(),
gleam@io:debug(_pipe@15),
_pipe@16 = given_some_example(),
gleam@io:debug(_pipe@16),
_pipe@17 = given_any_some_example(),
gleam@io:debug(_pipe@17),
_pipe@18 = given_all_some_example(),
gleam@io:debug(_pipe@18),
_pipe@19 = given_none_example(),
gleam@io:debug(_pipe@19),
_pipe@20 = given_any_none_example(),
gleam@io:debug(_pipe@20),
_pipe@21 = given_all_none_example(),
gleam@io:debug(_pipe@21).