module
Athena::Spec
Overview
A set of common Spec compliant testing utilities/types.
Defined in:
athena-spec.crmethods.cr
Constant Summary
-
VERSION =
"0.4.2"
Class Method Summary
-
.run_all : Nil
Runs all
ASPEC::TestCases.
Macro Summary
-
compile_time_assert(condition, message = "Compile-time assertion failed")
Asserts a condition, raising message if it is falsey.
Class Method Detail
def self.run_all : Nil
#
Runs all ASPEC::TestCases.
Is equivalent to manually calling .run on each test case.
Macro Detail
macro compile_time_assert(condition, message = "Compile-time assertion failed")
#
Asserts a condition, raising message if it is falsey.
This is primarily intended to be used with ASPEC::Methods.assert_compiles to assert state that exists at compile time.
An example of this is how internally Athena's specs do something like this to assert aspects of wired up services are correct:
ASPEC::Methods.assert_compiles <<-'CR'
require "../spec_helper"
@[ADI::Register(public: true)]
record MyService
macro finished
macro finished
\{%
service = ADI::ServiceContainer::SERVICE_HASH["my_service"]
%}
ASPEC.compile_time_assert(\{{ service["public"] == true }}, "Expected service to be public")
end
end
CR