-module(dream_test@matchers@boolean). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/dream_test/matchers/boolean.gleam"). -export([be_true/1, be_false/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Boolean matchers for dream_test.\n" "\n" " These matchers check boolean values.\n" " They're re-exported through `dream_test/assertions/should`.\n" "\n" " ## Usage\n" "\n" " ```gleam\n" " import dream_test/assertions/should.{should, be_true, be_false, or_fail_with}\n" "\n" " is_valid(input)\n" " |> should()\n" " |> be_true()\n" " |> or_fail_with(\"Input should be valid\")\n" "\n" " is_empty(list)\n" " |> should()\n" " |> be_false()\n" " |> or_fail_with(\"List should not be empty\")\n" " ```\n" ). -file("src/dream_test/matchers/boolean.gleam", 45). -spec check_is_true(boolean()) -> dream_test@types:match_result(boolean()). check_is_true(Actual) -> case Actual of true -> {match_ok, true}; false -> Payload = {boolean_failure, false, true}, {match_failed, {assertion_failure, <<"be_true"/utf8>>, <<""/utf8>>, {some, Payload}}} end. -file("src/dream_test/matchers/boolean.gleam", 38). ?DOC( " Assert that a value is `True`.\n" "\n" " ## Example\n" "\n" " ```gleam\n" " is_valid(input)\n" " |> should()\n" " |> be_true()\n" " |> or_fail_with(\"Input should be valid\")\n" " ```\n" ). -spec be_true(dream_test@types:match_result(boolean())) -> dream_test@types:match_result(boolean()). be_true(Value_or_result) -> case Value_or_result of {match_failed, Failure} -> {match_failed, Failure}; {match_ok, Actual} -> check_is_true(Actual) end. -file("src/dream_test/matchers/boolean.gleam", 78). -spec check_is_false(boolean()) -> dream_test@types:match_result(boolean()). check_is_false(Actual) -> case Actual of false -> {match_ok, false}; true -> Payload = {boolean_failure, true, false}, {match_failed, {assertion_failure, <<"be_false"/utf8>>, <<""/utf8>>, {some, Payload}}} end. -file("src/dream_test/matchers/boolean.gleam", 71). ?DOC( " Assert that a value is `False`.\n" "\n" " ## Example\n" "\n" " ```gleam\n" " is_empty(list)\n" " |> should()\n" " |> be_false()\n" " |> or_fail_with(\"List should not be empty\")\n" " ```\n" ). -spec be_false(dream_test@types:match_result(boolean())) -> dream_test@types:match_result(boolean()). be_false(Value_or_result) -> case Value_or_result of {match_failed, Failure} -> {match_failed, Failure}; {match_ok, Actual} -> check_is_false(Actual) end.