Statifier.FeatureDetector (statifier v1.9.0)
View SourceDetects SCXML features used in documents to enable proper test validation.
This module analyzes SCXML documents (either raw XML strings or parsed Statifier.Document structures) to identify which SCXML features are being used. This enables the test framework to fail appropriately when tests depend on unsupported features.
Summary
Functions
Detects features used in an SCXML document.
Returns a registry of all known SCXML features with their support status.
Checks if all detected features are supported or partially supported.
Functions
@spec detect_features(String.t() | Statifier.Document.t()) :: MapSet.t(atom())
Detects features used in an SCXML document.
Takes either a raw XML string or a parsed Statifier.Document and returns a MapSet of feature atoms representing the SCXML features detected in the document.
Examples
iex> xml = "<scxml><state id='s1'><transition event='go' target='s2'/></state></scxml>"
iex> Statifier.FeatureDetector.detect_features(xml)
#MapSet<[:basic_states, :event_transitions]>
iex> {:ok, document} = Statifier.Parser.SCXML.parse(xml)
iex> Statifier.FeatureDetector.detect_features(document)
#MapSet<[:basic_states, :event_transitions]>
@spec feature_registry() :: %{ required(atom()) => :supported | :unsupported | :partial }
Returns a registry of all known SCXML features with their support status.
Features are categorized as:
:supported- Fully implemented and working:unsupported- Not yet implemented:partial- Partially implemented (may work in simple cases)
Checks if all detected features are supported or partially supported.
Returns {:ok, features} if all features are supported or partial,
or {:error, unsupported_features} if any completely unsupported features are detected.
Partial features are allowed to run as they may work in simple cases.